How do you open the cd-rom in c++

Started by
13 comments, last by v0id 22 years, 3 months ago
Just wondering if anyone could give me the code to open the CD-ROM drive in c++ in windows
-< v0id http://ohiostreetcrew.cjb.net/ >-
Advertisement
In what way ? do you just want to open files, in which case the standard methods (fopen, CreateFileEx etc.) will work fine - or do you want to be able to read the raw data - block by block - like a MP3 ripper ? - in that case try searching for AKRIP - I can''t remember the address - I think it may be on source forge - but anyhow it''s an open source program that uses WNASPI to access the CD & read the raw data - I think it''s also got some ASPI tuts
i think he means to open the cd rom bay door...i''m not sure, check MSDN.
[source]#define JESUS 1[/source]
If you''re trying to eject the cd-rom, then it''s not too hard:

#include <mmsystem.h>

mciSendString("set cdaudio door open", NULL, 0, NULL);
yeah i just want to know how to pop the drive open, so i can mess with my friends computer
-< v0id http://ohiostreetcrew.cjb.net/ >-
You mean like a Trojan?? *tsk tsk*

"I''ve learned something today: It doesn''t matter if you''re white, or if you''re black...the only color that REALLY matters is green"
-Peter Griffin
"I've learned something today: It doesn't matter if you're white, or if you're black...the only color that really matters is green"-Peter Griffin
hehe

'Very funny, Scotty. Now beam down my clothes.' -

[TheBlackJester]

"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

if you are using the Dev-C++ compiler, use this

mciSendString("set cdaudio door open", NULL, 0, NULL);

you can also set the door to close using closed as your option instead of open

p.s.Thanks for this(did not know about it yet in my young programming lifetime)...I got my mother and daughter both with this thinking that they had ran a bug or virus...heehe...
if you are using the Dev-C++ compiler, use this

mciSendStringA("set cdaudio door open", NULL, 0, NULL);

forgot this one up above...the ''A''..sorry for the double-post!

you can also set the door to close using closed as your option instead of open

p.s.Thanks for this(did not know about it yet in my young programming lifetime)...I got my mother and daughter both with this thinking that they had ran a bug or virus...heehe...
Hmmm, is it just my browser, or does something in the sig of BlackJester make the formating of this thread look somewhat weird ?

This topic is closed to new replies.

Advertisement