getting a CD drive under Windows

Mark Wieder mwieder at ahsoftware.net
Sat May 29 01:14:30 EDT 2004


Chris-

Friday, May 28, 2004, 9:25:31 AM, you wrote:

CS> I know I can use the Volumes() function to get a list of available drives,
CS> but how can I determine which drives are actually CD-ROM drives?

Well, there are two "standard" ways to do this, neither of which can
be done natively from runrev. The first is to call the WinAPI function
GetDriveType(). If the result is DRIVE_CDROM then you've found your
drive, otherwise check the next drive. This would be straightforward
to code as an external.

The second way is to look at HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\
in the registry, take only the keys that start with \DosDevices\, and
work your way through those. Unfortunately, the runrev queryRegistry()
function doesn't work that way - you have to give it a fully qualified
keypath and can't enumerate through the possibilities.

The registry trick also has the drawback of possibly not working
across all Win versions. I haven't looked at them all, so I don't know
for sure. It does work on our Win2k systems here. In short, I think
you're stuck with a bit of C coding in an external dll.

-- 
-Mark Wieder
 mwieder at ahsoftware.net



More information about the use-livecode mailing list