How to check the type of Drive
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 'File/Folder Handling - How to check the type of Drive Option Explicit Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" _ (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Sub Main() Dim DriveType& DriveType& = GetDriveType("C:\") 'GetDriveType("A:\") Select Case DriveType Case 1, 3 MsgBox "Hard Disk" Case 2 MsgBox "Floppy Drive" Case 4 MsgBox "Remote" Case 5 MsgBox "CD Rom" Case 6 MsgBox "RamDisk" End Select End Sub |