How to return the drive type
Posted on January 4, 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 25 26 27 28 29 30 | 'System & API - How to return the drive type Option Explicit Public Const DRIVE_CDROM = 5 Public Const DRIVE_FIXED = 3 Public Const DRIVE_RAMDISK = 6 Public Const DRIVE_REMOTE = 4 Public Const DRIVE_REMOVABLE = 2 Public Const DRIVE_UNKNOWN = 0 Private Declare Function GetDriveTypeA Lib "kernel32" (ByVal nDrive As String) As Long Public Function sDriveType(ByVal sDriveLetter As String) As String Dim lRet As Long lRet = GetDriveTypeA(sDriveLetter & ":\") Select Case lRet Case 0 sDriveType = "Unknown" Case 1 sDriveType = "Unknown" Case DRIVE_CDROM: sDriveType = "CD-ROM Drive" Case DRIVE_REMOVABLE: sDriveType = "Removable Drive" Case DRIVE_FIXED: sDriveType = "Fixed Drive" Case DRIVE_REMOTE: sDriveType = "Network Drive" End Select End Function |