Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write the code to display files and directories in a driver

Status
Not open for further replies.

hungnguyen

Programmer
Sep 22, 2000
43
US
HI TMG
Would you be more specific??
Also What code you should write to indicate whether the drive is ready???
if you have a familiar source code, please give me so.

Thanks a lot
bye
Hung





 
Hi

You have several functions to do the job:

1. GetLogicalDriveStrings: you'll fill a buffer with strings that specify valid drives in the system. Each string describing a drive is Null terminated. Extracting drive spec. is easy and you then call the next functions ...

2. GetDriveType(): you'll get the type of drive:

DRIVE_UNKNOWN The drive type cannot be determined.
DRIVE_NO_ROOT_DIR The root directory does not exist.
DRIVE_REMOVABLE The disk can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.

If you want to check if a drive is ready, this is always true for DRIVE_FIXED. You only have to check DRIVE_REMOVABLE and DRIVE_CDROM. See next function ...

3. GetVolumeInformation: you'll get the Serial Number and the file system of the drive. If the serial number is Zero, it means that the floppy ( or the CDRom) is not inserted in the drive.

Hence the drive is not ready. From here, you'll use the CFileFind class as I described before

HTH

Thierry
EMail: Thierry.Marneffe@swing.be


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top