Solved

MCI: how to determine CDaudio drive door status

Posted on 1998-07-16
6
338 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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 use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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