Is there any way to search information about disk drives attached to your computer in VB.
thanks in advance
Jamppa
Printable View
Is there any way to search information about disk drives attached to your computer in VB.
thanks in advance
Jamppa
Try something like:------------------Code:Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_CDROM = 5
Private Const DRIVE_FIXED = 3
Private Const DRIVE_RAMDISK = 6
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_REMOVABLE = 2
Private Sub Form_Load()
Dim sDrives As String
Dim sDrive As String
sDrives = Space(255)
sDrives = Left$(sDrives, GetLogicalDriveStrings(255, sDrives))
While Len(sDrives)
sDrive = UCase(Left$(sDrives, 3) & Space(10))
sDrives = Mid$(sDrives, 5)
Select Case GetDriveType(Trim(sDrive))
Case DRIVE_CDROM
sDrive = sDrive & "CD-ROM"
Case DRIVE_FIXED
sDrive = sDrive & "HDD (Fixed)"
Case DRIVE_RAMDISK
sDrive = sDrive & "RAM Disk"
Case DRIVE_REMOTE
sDrive = sDrive & "Remote (Network)"
Case DRIVE_REMOVABLE
sDrive = sDrive & "Removable (Diskette)"
Case Else
sDrive = sDrive & "Unknown"
End Select
List1.AddItem sDrive
Wend
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Certified AllExperts Expert
But how do we differentiate the removable drive ???
Is it a 1.44 MB floppy or a 1.2 MB thing ??
or a 100MB Drive ??