Solved

MCI: how to determine CDaudio drive door status

Posted on 1998-07-16
4
301 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now