Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MCI: how to determine CDaudio drive door status

Posted on 1998-07-16
6
Medium Priority
?
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 600 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 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