Detect disc in drive

BlitzMax Forums/BlitzMax Beginners Area/Detect disc in drive

Bremer(Posted 2007) [#1]
Is there a way to detect whether or not there is a disc in a dvd drive? I have looked at the documentation and done a number of searches on the forum, but found nothing.

Does anyone have an example, some code, which shows how to find out if there is a disc in the drive?

It can be windows specific, because I only need this for something running on windows.

[edit]

It looks like GetVolumeInformation winApi function will do the trick. I found a thread where the user Grable had posted a conversion of this extern. And when using it, if the volume label is empty, then there is no disc in the drive, unless ofcause someone made a cd/dvd without a label, which I haven't tried out to be honest. But who makes discs without labels anyways? I know I don't.

The code Grable wrote can be found here:

http://www.blitzmax.com/Community/posts.php?topic=68452#764890

If there is a simpler solution, I would still like to know about it, but until then, this will do.


xlsior(Posted 2007) [#2]
Brucey has a Volumes mod whichwill retun a bunch of info for different drives in the system.


Bremer(Posted 2007) [#3]
I did know about Brucey's mod, but for this task I did not want to include a complete mod, but just what was needed to do this one specific task, which is why I didn't go for his mod.


GfK(Posted 2007) [#4]
I did know about Brucey's mod, but for this task I did not want to include a complete mod, but just what was needed to do this one specific task, which is why I didn't go for his mod
??

Brucey's Volumes mod is tiny.


Brucey(Posted 2007) [#5]
I've got some nice OS X code that raises an event when you insert something (like a CD/USB stick/etc) :-)