LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can detect that cdrom drive were opened and closed?

How can detect that cdrom drive were opened and closed?
0 Kudos
Message 1 of 4
(2,870 Views)

I'm sure there are more elegant and complicated ways to accomplish this using Windows SDK function calls to kernel32.dll or something extravagant like that, but if you want the bare-bones easy way to check if the CD-ROM tray is currently opened, then simply use System Exec to query the CD-ROM drive from the command line. One example of this is shown below.

Use the command line function cmd /c d:, where d: is your CD-ROM drive. If the Standard Error output from System Exec.vi is "The device is not ready." followed by a carraige return and line feed, then voila, your CD-ROM drive is open. If not, it's closed. Anyone have a better idea? I'm sure one exists...

Message Edited by Jarrod S. on 02-16-2006 12:23 PM

Jarrod S.
National Instruments
Message 2 of 4
(2,859 Views)
It can be done through the MCI API. See here.

___________________
Try to take over the world!
Message 3 of 4
(2,840 Views)
I would like to join in on the question: Does anybody know a way to do the same at MacOS 9 and 10?
0 Kudos
Message 4 of 4
(2,839 Views)