eject the cdrom
-
Hi, I wouldnt normally ask this but I am trying to make a little joke program for my friend who is graduating. I have seen this before but dont know the source and he is graduating soon. Basically, a window would pop up when the prog was executed and say somehting like "for your graduation present... blah, blah you recieve this university cup holder" Then you click ok and the cdrom opens.... hehe....I think its funny.. Can anybody help me out.. .Like I said I normally wouldnt ask but im pressed for time and dont know if I can figure it out in time. im a newbie to MFC... thanks! harry at forbess.com;) harry
-
Hi, I wouldnt normally ask this but I am trying to make a little joke program for my friend who is graduating. I have seen this before but dont know the source and he is graduating soon. Basically, a window would pop up when the prog was executed and say somehting like "for your graduation present... blah, blah you recieve this university cup holder" Then you click ok and the cdrom opens.... hehe....I think its funny.. Can anybody help me out.. .Like I said I normally wouldnt ask but im pressed for time and dont know if I can figure it out in time. im a newbie to MFC... thanks! harry at forbess.com;) harry
Post your question in the Visual C++ forum. This is our place to get away from coding for a bit. :) Jon Sagara "Ninety percent of baseball is mental, the other half is physical." -- Yogi Bera
-
Hi, I wouldnt normally ask this but I am trying to make a little joke program for my friend who is graduating. I have seen this before but dont know the source and he is graduating soon. Basically, a window would pop up when the prog was executed and say somehting like "for your graduation present... blah, blah you recieve this university cup holder" Then you click ok and the cdrom opens.... hehe....I think its funny.. Can anybody help me out.. .Like I said I normally wouldnt ask but im pressed for time and dont know if I can figure it out in time. im a newbie to MFC... thanks! harry at forbess.com;) harry
Forbess Enterprises Corporate Army Takes Wathefukistan :laugh: Jon Sagara "Ninety percent of baseball is mental, the other half is physical." -- Yogi Bera
-
Hi, I wouldnt normally ask this but I am trying to make a little joke program for my friend who is graduating. I have seen this before but dont know the source and he is graduating soon. Basically, a window would pop up when the prog was executed and say somehting like "for your graduation present... blah, blah you recieve this university cup holder" Then you click ok and the cdrom opens.... hehe....I think its funny.. Can anybody help me out.. .Like I said I normally wouldnt ask but im pressed for time and dont know if I can figure it out in time. im a newbie to MFC... thanks! harry at forbess.com;) harry
This should really be in the VC++ forum, but anyway - this works for me:-
void OpenCDDrive(CString strDrive)
{
MCI_OPEN_PARMS op;
MCI_STATUS_PARMS st;
DWORD flags;TCHAR szDriveName\[4\]; strcpy(szDriveName, \_T("$:")); ::ZeroMemory(&op, sizeof(MCI\_OPEN\_PARMS)); op.lpstrDeviceType = (LPCSTR)MCI\_DEVTYPE\_CD\_AUDIO; // end now if we haven't specified a drive if (strDrive.IsEmpty()) return; szDriveName\[0\] = strDrive.GetBuffer(1)\[0\]; op.lpstrElementName = szDriveName; flags = MCI\_OPEN\_TYPE | MCI\_OPEN\_TYPE\_ID | MCI\_OPEN\_ELEMENT | MCI\_OPEN\_SHAREABLE; // send the command if (!mciSendCommand(0, MCI\_OPEN, flags, (unsigned long)&op)) { st.dwItem = MCI\_STATUS\_READY; mciSendCommand(op.wDeviceID, MCI\_SET, MCI\_SET\_DOOR\_OPEN, 0); mciSendCommand(op.wDeviceID, MCI\_CLOSE, MCI\_WAIT, 0); }
}
________________ David Wulff http://www.davidwulff.co.uk "I loathe people who keep dogs. They are cowards who haven't got the guts to bite people themselves" - August Strindberg