Click to See Complete Forum and Search --> : CD Tray notification


Hobson
January 31st, 2007, 05:57 AM
Hello folks, I have a question: Is it possible to make my application notified about CD-ROM events? Mostly I am interested at eject notification, I want my app to be able to respond somehow to this event. I have been searching for some MCI command or something, but found nothing useful. I think that it is possible to do, because i.e. Windows Explorer closes all folder windows which are on CD, when media is ejected. I just do not know where to start, is there some message to handle? Or maybe I sould mess around with CD-ROM driver?

Thanks for any help,
Hob

PeejAvery
January 31st, 2007, 09:32 AM
The following gave me a lot of thoughts.

http://www.google.com/search?hl=en&q=detect+cd+eject&btnG=Google+Search

Hobson
January 31st, 2007, 09:56 AM
hmm I think that 'detect' is the word I was missing when googling. Thanks, now I'd have to try to convert it somehow to C++. But not today, someday else.

Thanks,
Hob

Brenton S.
January 31st, 2007, 10:13 AM
You could try this:

MCI_STATUS_PARMS msp;
msp.dwItem = MCI_STATUS_MODE;
mciSendCommand(mciGetDeviceID("cdaudio"), MCI_STATUS_ITEM, MCI_WAIT, (DWORD)(LPVOID)&msp);
if(msp.dwReturn == MCI_MODE_OPEN) {
/* Do something */
}

:wave: