IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 21 Temmuz 2008, 18:16   #1
Çevrimdışı
Yardımcı Admin
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
CD Sürücüsünü Bulma




PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
 Option Explicit
 
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As LongByVal lpBuffer As String) As Long
Private Const DRIVE_REMOVABLE 2
Private Const DRIVE_FIXED 3
Private Const DRIVE_REMOTE 4
Private Const DRIVE_CDROM 5
Private Const DRIVE_RAMDISK 6
 
 
 
Function StripNulls(startStrg$) As String
 
'Take a string separated by Chr$(0)'s, and split off 1 item, and
'shorten the string so that the next item is ready for removal.
 
  Dim c%, item$
  c% = 1
 
  Do
 
    If Mid$(startStrg$, c%, 1) = Chr$(0) Then
 
      item$ = Mid$(startStrg$, 1, c% - 1)
      startStrg$ = Mid$(startStrg$, c% + 1, Len(startStrg$))
      StripNulls$ = item$
      Exit Function
 
    End If
 
    c% = c% + 1
 
  Loop
 
End Function
Private Sub Form_Load()
 
Dim r&, allDrives$, JustOneDrive$, pos%, DriveType&
Dim CDfound As Integer
 
  '
pad the string with spaces
   allDrives
$ = Space$(64)
 
  
'call the API to get the string containing all drives
   r& = GetLogicalDriveStrings(Len(allDrives$), allDrives$)
 
  '
trim off trailing chr$(0)'s.  AllDrives$
  '
now contains all the drive letters.
   
allDrives$ = Left$(allDrives$, r&)
 
  
'begin a loop
   Do
 
     '
find the first separating chr$(0)
      
pos% = InStr(allDrives$, Chr$(0))
 
     
'if there's onethen...
      If 
posThen
 
       
'extract the drive up to the chr$(0)
        JustOneDrive$ = Left$(allDrives$, pos%)
 
       '
and remove that from the Alldrives string,
       
'so it won't be checked again
        allDrives
$ = Mid$(allDrives$, pos% + 1Len(allDrives$))
 
       
'with the one drive, call the API to
       '
determine the drive type
        DriveType
& = GetDriveType(JustOneDrive$)
 
       
'check if it's what we want
        
If DriveType& = DRIVE_CDROM Then
 
          
'got it (or at least the first one,
          '
anyway, if more than one), so set
          
'the found flag...
           CDfound% = True
 
          '
we're done, so get out
           Exit Do
 
        End If
      End If
 
  Loop Until allDrives$ = "" Or DriveType& = DRIVE_CDROM
 
 '
display the appropriate message
  
If CDfoundThen
        Label1 
"The CD-ROM drive on your system is drive " UCase$(JustOneDrive$)
  Else: 
Label1 "No CD-ROM drives were detected on your system."
  
End If
 
End Sub 

Alıntı

__________________
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları sohbet odaları Benimmekan Mobil Sohbet
Cevapla

Etiketler
bulma, sürücüsünü


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 
Seçenekler
Stil

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Motosiklet sürücüsünü kaskı kurtardı Seth Haber Arşivi 0 12 Kasım 2014 15:10
Kingston yeni USB sürücüsünü duyurdu! Deep Bilgisayar Donanımı 0 31 Ekim 2012 20:11
CD Sürücüsünü Açma / Kapatma Cemalizim C# 0 19 Temmuz 2008 15:53