Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
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 Command1_Click()
Dim myLength As Integer
Dim myBuffer As String
Dim i As Integer
Dim myDrive As String
Dim myType As Long
myLength = GetLogicalDriveStrings(0, 0)
myBuffer = String$(myLength, 0)
myLength = GetLogicalDriveStrings(myLength, myBuffer)
For i = 1 To Len(myBuffer) - 1 Step 4
myDrive = Mid$(myBuffer, i, 3)
myType = GetDriveType(myDrive)
Select Case myType
Case DRIVE_CDROM
MsgBox myDrive & " is a CD-Rom Drive", _
vbOKOnly + vbInformation, _
"Your Drives"
Case DRIVE_FIXED
MsgBox myDrive & " is a Fixed Drive", _
vbOKOnly + vbInformation, _
"Your Drives"
Case DRIVE_RAMDISK
MsgBox myDrive & " is a Ram Disk", _
vbOKOnly + vbInformation, _
"Your Drives"
Case DRIVE_REMOTE
MsgBox myDrive & " is a Remote Drive", _
vbOKOnly + vbInformation, _
"Your Drives"
Case DRIVE_REMOVABLE
MsgBox myDrive & " is a Removable Drive", _
vbOKOnly + vbInformation, _
"Your Drives"
Case Else
MsgBox "The following drive " & CStr(myDrive) & " is not recognised.", _
vbOKOnly + vbCritical, _
"Your Drives"
End Select
Next
End Sub