View Full Version: Open CD Example

C++ Learning Community > C++ Creations > Open CD Example


Title: Open CD Example
Description: by sending a string


donprogc++ - December 22, 2004 04:00 AM (GMT)
just a way to open your cd tray by sending a string to it
CODE

#include <windows.h>

int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
LPSTR lpszArgument,int nFunsterStil)
{
char string[22] = "set cdaudio door open";
int status;
MessageBox(0,"CD Tray attempting to open..","CD Tray",MB_ICONINFORMATION);
status = mciSendStringA(string,0,0,0);
     if(status = 0)
     {
       MessageBox(0,"Error Opening CD tray","Error",MB_ICONERROR);
        return 1;
     }
return 0;
}

dont forget to link to winmm

MonkeyMan - December 22, 2004 10:05 PM (GMT)
Now use that and similar commands to make a simple cd audio player. :lol:

donprogc++ - December 23, 2004 01:21 AM (GMT)
I once saw a program where it prompts you for a place to put your beer and if you click yes it opens up the cd tray :lol:

ih8censorship - December 23, 2004 02:35 AM (GMT)
hey thanks i never could figure out what string would open the door. is there a big list of mci strings somewhere?

KTC - December 23, 2004 03:22 AM (GMT)

donprogc++ - December 23, 2004 03:32 PM (GMT)
No problem :D
I forgot some of the strings myself
I was thinking about making an audio player

MonkeyMan - December 23, 2004 04:03 PM (GMT)
In the Masm or Fasm asm compilers, I forget which, has the beer example. It is actually quite popular for what it is. :P




* Hosted for free by InvisionFree