Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Platforms: Win 32s, Win 95/98, Win NT
GetDriveType finds the type of disks a disk drive is/uses. This could be a fixed (hard) drive, a floppy drive, a CD-ROM drive, etc. The function returns the drive type. 0 means that an error occured. 1 means that the specified drive does not exist. Other return values are one of the following flags identifying the drive type:
Example:
' Determine what type of drive D: is
Dim drivetype As Long ' receives the drive type
drivetype = GetDriveType("d:\") ' determine which kind of drive this is
If drivetype = 1 Then Debug.Print "Drive D:\ does not exist."
If drivetype = DRIVE_REMOVABLE Then Print "Drive D:\ is a removable-disk drive."
If drivetype = DRIVE_FIXED Then Print "Drive D:\ is a hard drive."
If drivetype = DRIVE_CDROM Then Print "Drive D:\ is a CD-ROM drive."
' etc.
Category: Files
Back to the index.