Solved

MCI: how to determine CDaudio drive door status

Posted on 1998-07-16
6
326 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 instead of MCI_Set_Door_Open.
0
Comment
Question by:mauromol
  • 3
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 1410340
You may need to do some experiments.

Try using the MCI_STATUS command with the flags MCI_STATUS_READY or MCI_STATUS_MEDIA_PRESENT. This may not meet your requirements. Then, you can get the notification of CD-ROM insertion or removal. See the following KB article.
HOWTO: Getting Notification of CD-ROM Insertion or Removal  
http://support.microsoft.com/support/kb/articles/q163/5/03.asp
0
 

Expert Comment

by:overworked
ID: 1410341
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: 1410342
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:mauromol
ID: 1410343
To chensu: I had a look to the link you gave me: thank you!
I would have only a question: Microsoft says that the Device Type should be a dbt_DevTyp_Volume, but when I intercept wm_DeviceChange, dbch_DeviceType seems to be set to dbt_DevTyp_OEM. Why?
Delphi doesn't define dbt constants: I use explicit numbers for that (dbt_DeviceArrival = $8000, where $ means hex number; dbt_DeviceRemoveComplete = $8004; dbt_DevTyp_Volume = $2), but both dbt_DeviceArrival and dbt_DeviceRemoveComplete return $0 (that should be dbt_DevTyp_OEM, shouldn't it?) instead of $2. Maybe you know where the problem is?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1410344
On my computer, dbch_devicetype is DBT_DEVTYP_VOLUME. Check it carefully. And, try it on other computers.
0
 

Author Comment

by:mauromol
ID: 1410345
Ok, I got it to work, thank you!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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: …

746 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

10 Experts available now in Live!

Get 1:1 Help Now