|
-
Feb 11th, 2000, 04:29 PM
#1
Thread Starter
Junior Member
Is there any way to search information about disk drives attached to your computer in VB.
thanks in advance
Jamppa
-
Feb 11th, 2000, 04:44 PM
#2
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
-
Feb 12th, 2000, 03:28 AM
#3
Addicted Member
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 ??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|