Windows API Guide: FindNextFile Function


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:

DRIVE_CDROM = 5
A CD-ROM drive.
DRIVE_FIXED = 3
A hard drive.
DRIVE_RAMDISK = 6
A RAM disk.
DRIVE_REMOTE = 4
A network drive or a drive located on a network server.
DRIVE_REMOVABLE = 2
A floppy drive or some other removable-disk drive.
nDrive
The root directory of the drive to check, such as "c:\" or "a:\"

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

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/getdrivetype.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net