Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Drive Display
#19
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
Reply


Messages In This Thread
Simple Drive Display - by eoredson - 12-10-2022, 04:43 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 06:58 AM
RE: Simple Drive Display - by eoredson - 12-10-2022, 07:21 AM
RE: Simple Drive Display - by mnrvovrfc - 12-10-2022, 07:41 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 07:57 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 08:28 AM
RE: Simple Drive Display - by eoredson - 12-10-2022, 08:50 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 08:58 AM
RE: Simple Drive Display - by eoredson - 12-10-2022, 09:06 AM
RE: Simple Drive Display - by mnrvovrfc - 12-10-2022, 09:16 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 05:39 PM
RE: Simple Drive Display - by eoredson - 12-11-2022, 02:43 AM
RE: Simple Drive Display - by mnrvovrfc - 12-11-2022, 08:20 AM
RE: Simple Drive Display - by eoredson - 12-11-2022, 03:00 AM
RE: Simple Drive Display - by Pete - 12-11-2022, 03:45 AM
RE: Simple Drive Display - by eoredson - 12-11-2022, 05:30 AM
RE: Simple Drive Display - by eoredson - 12-12-2022, 05:38 AM
RE: Simple Drive Display - by Pete - 12-12-2022, 06:10 AM
RE: Simple Drive Display - by SMcNeill - 12-12-2022, 06:22 AM
RE: Simple Drive Display - by eoredson - 12-13-2022, 05:53 AM
RE: Simple Drive Display - by SpriggsySpriggs - 12-13-2022, 03:00 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 03:22 PM
RE: Simple Drive Display - by SpriggsySpriggs - 12-13-2022, 04:21 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 04:33 PM
RE: Simple Drive Display - by SpriggsySpriggs - 12-13-2022, 06:09 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 07:05 PM
RE: Simple Drive Display - by vince - 12-13-2022, 10:25 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 10:46 PM



Users browsing this thread: 10 Guest(s)