Click to See Complete Forum and Search --> : URGENT ! Eject CDROM programmatically


Hardeep Singh
April 15th, 1999, 08:37 AM
How do I eject the CDROM drive from my program?

Ma Long
April 15th, 1999, 09:11 AM
You can download the source code at
http://www.codeguru.com/multimedia/cd_audio.shtml

Hardeep Singh
April 16th, 1999, 09:40 AM
Hey, thanks, but I don't need any of that CD Audio system stuff, just the part that ejects / closes the CDROM drive. I can't use only that part from the sample without having the rest, and it'll just weigh my program down unnecessarily. Can you tell me the bare minimum I need to do open/close the door? I isolated the function that did it, but what about the initialization and everything on which the function indirectly depends?

G Kirkham
April 16th, 1999, 11:09 AM
Have a look at DeviceIoControl. The way you use it depends on if you are running 95/98 or NT

Hope this helps,
Gary Kirkham

R.K.M.
April 16th, 1999, 03:32 PM
#include <windows.h>

void main(void)
{
char returnstring[1024];
MCIERROR result;
result = mciSendString("set CDAudio door closed",
returnstring, 127, 0);
}

Hardeep Singh
April 17th, 1999, 12:02 AM
Hey, thanks a lot dude!
Just one more thing... if I want to detect the current state (open/closed) and then give the appropriate command(close/open), what should I do?