# GetDriveType Function

`Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long`

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 (non-error) return values are one of the drive type flags.

nDrive
  The root directory of the drive to check, such as "c:\" or "a:\"

Example:

    ' Check to see what type of drive C: is
    x = GetDriveType("c:\")
    ' x should be DRIVE_FIXED, or a hard drive

Category: Files
Back to the index.