Re:How to determine the drive-letter of the cd-rom drive
Quote
"Jimmy Rasmussen" <jim...@get2net.dk> wrote in message
news:38lC6.381$HG6.5001@news.get2net.dk...
Quote
> I recently discovered that when you type %systemroot% in explorer you are
> taken to the windows directory. I'm wondering if there are other "standard
> paths" that I can use. Like for the cd-rom for instance.
> I'm making a program that uses files from a cd-rom but since the
> drive-letter of the cd-rom varies depending on what computer you're using
> how do you obtain files from a cd? (You can't type D:\files\)
Well, you shouldn't make assumptions about CD Drives. %systemroot%,
%windir%, etc., are rock solid because - after all - which Windows system is
not going to have them?
CD Drives are not only optional, but even if there was a predefined path in
a system variable, the CD you want to read off might not be in the drive.
So, you should ultimately ask the user to insert the appropriate CD and to
tell you in which drive it was inserted.
If you really must detect a CD drive (or drives), use GetLogicalDrives() to
get a bitmask representing all the drives on the system, then loop through
each drive calling GetDriveType(). For each drive type that is DRIVE_CDROM
you've hit the jackpot.
Do bear in mind that your users systems may have multiple CD Drives. In
fact it's quite common now DVD drives are here. DVD & CDROM drives types
are both DRIVE_CDROM.
Regards
--
i l * m o d e r n o
quello che vedi quello che ottieni
-----------------------
http://mysite.ciaoweb.it/il-moderno/
il-mode...@ciaoweb.it