|
How to recognize drive types
If you're using VB4 32 bit, you can use the GetLogicalDrives API to get a 32-bit bitmask of all valid drive letters. FOr example, bit 0 is drive A. If it's a 1, then there is drive A in the system. Then use GetDriveType(""A:"") and check the return. if the drive is a CD-ROM, you will get a return of DRIVE_CDROM.
Author: Simon Bernstein
Dim dwDrives As Long
Dim i As Integer
Dim Mask As Long
dwDrives = GetLogicalDrives()
Mask = 1
For i = 0 To 26
If (dwDrives And Mask) Then
If (GetDriveType(Chr(65 + i) & "":"") = DRIVE_CDROM) Then
' This drive is a CD-ROM
End If
End If
Mask = Mask * 2
Next i
|
||
|
Editor: Simon Bernstein Last update: 2025-11-05 Copyright 1995-2025 VBI |