12-12-2022, 06:22 AM
From the wiki, there's this simple routine:
Code: (Select All)
Const REMOVABLE = 2
Const FIXED = 3
Const REMOTE = 4
Const CDROM = 5
Const RAMDISK = 6
Declare Library
Function GetDriveTypeA& (nDrive As String)
Function GetLogicalDriveStringsA (ByVal nBuff As Long, lpbuff As String)
End Declare
Dim DList As String, DL As String
Dim i As Long, typ As Long
i = GetLogicalDriveStringsA(0, DList) 'zero returns the drive string byte size
DList = Space$(i) 'set drive string length. Each drive is followed by CHR$(0)
i = GetLogicalDriveStringsA(i, DList) 'the byte size returns a string that long
Print DList
For n = 65 To 90
If InStr(DList, Chr$(n)) Then
DL = Chr$(n) + ":\" + Chr$(0)
typ = GetDriveTypeA(DL)
Select Case typ
Case REMOVABLE: Print DL + "Removable"
Case FIXED: Print DL + "Fixed"
Case REMOTE: Print DL + "Remote"
Case CDROM: Print DL + "CDROM"
Case RAMDISK: Print DL + "RAM"
End Select
End If
Next