Determining if a disc is inserted under win32.

Adam Gates adam at
Sun Sep 2 19:13:26 EDT 2001

"Ryan C. Gordon" wrote:
> Adam:
> What do you recommend for determining if a CD-ROM is actually inserted in
> a drive (mounted) under Win32?
> GetDriveType() will tell us only if the drive is a CD-ROM drive. Is the
> best plan to just see if FindFirstFile("X:\\*") fails on a drive that
> reports itself to be a CD-ROM reader?
> Thanks,
> --ryan.

I don't know of anyway that actually works.

You could try opening something, maybe get a directory listing. I do
remember that it is possible to stop the system for prompting for a
disk. I don't know if it happens with a cd drive but it does happen with
the floppy drive. Usually comes up with a message box saying "Abort",
"Retry" or "Ignore".

It may also be possible using the multimedia library. This has some
functions for opening and closing the cd drive.

So FindFirstFile is probably a good bet. Or try using OpenFile on the


More information about the physfs mailing list