MCI: how to determine CDaudio drive door status

I know MCI CDAudio device handling quite well, but I still don't know how to determine wether the CD-ROM drive door is open or closed, in order to distinguish when I have to call MCI_Set_Door_Closed or MCI_Set_Door_Open.
mauromolAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Tommy HuiConnect With a Mentor EngineerCommented:
The best way is to catch the WM_DEVICECHANGE message. Check to make sure the event type coming in is DBT_DEVICEARRIVAL or DBT_DEVICEREMOVECOMPLETE. This tells you whether the drive door is closed or opened respectively.

0
 
overworkedCommented:
MCI_STATUS_PARMS status;
status.dwitem = MCI_STATUS_MODE;

mciSendCommand(deviceid,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,*status);

if(status.dwReturn == MCI_MODE_OPEN
    The door is open
else
    The door is closed


I do this for my cd player to determine whether my eject button should send a MCI_SET_DOOR_CLOSED or _OPEN command.
0
 
mauromolAuthor Commented:
To overworked: this does not work, sorry. MCI_Mode_Open is returned both when the door is open and when the door is closed but the drive is empty.

0
 
mauromolAuthor Commented:
To thui: but in this way I must wait for a door movement. Isn't there any way to determine the drive door status just right in that moment?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.