Solved

MCI: how to determine CDaudio drive door status

Posted on 1998-07-16
4
306 Views
Last Modified: 2013-12-03
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.
0
Comment
Question by:mauromol
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1410336
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
 

Expert Comment

by:overworked
ID: 1410337
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
 

Author Comment

by:mauromol
ID: 1410338
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
 

Author Comment

by:mauromol
ID: 1410339
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

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question