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

x
?
Solved

Detecting CD Changes

Posted on 1998-05-26
4
Medium Priority
?
322 Views
Last Modified: 2013-11-20
Hi .. right now programming an API which playing CD through MCI device in C++ (using MFC)
Two questions in one :

-How could i detected the CD has been manually ejected , or inserted ? (i need a full source description please)
-What is the xorrect sentence to the mciCommandMsg to Ecjet a CD Track ?

Hope to catch an answer ASAP

Greetings .. Skiwoka
0
Comment
Question by:SkizoWalker
[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
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
tma050898 earned 300 total points
ID: 1315483
Answer coming
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1315484
SkizoWalker,

In order to open and close the cd drawer...

Step 1:
add include of "mmsystem.h"

Step 2:
add import library
winmm.lib

Step 3:
add following code

MCI_OPEN_PARMS OpenParms;
OpenParms.lpstrDeviceType = (LPCSTR) MCI_DEVTYPE_CD_AUDIO;
OpenParms.wDeviceID = 0;

// open device
if (!mciSendCommand (NULL, MCI_OPEN, MCI_WAIT |
 MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE,
 (DWORD)(LPVOID) &OpenParms))
{
 // open drawer
 mciSendCommand (OpenParms.wDeviceID,
  MCI_SET, MCI_SET_DOOR_OPEN, NULL);

 AfxMessageBox(_T("Press OK to close the CD drawer"));

 // close drawer
 mciSendCommand (OpenParms.wDeviceID,
  MCI_SET, MCI_SET_DOOR_CLOSED, NULL);

 // close device
 mciSendCommand (OpenParms.wDeviceID,
  MCI_CLOSE, MCI_WAIT, NULL);
}

I don't know, however, how to detect when the cd drawer has been opened manually.

Tom

0
 
LVL 23

Expert Comment

by:chensu
ID: 1315485
HOWTO: Getting Notification of CD-ROM Insertion or Removal
http://support.microsoft.com/support/kb/articles/q163/5/03.asp
0
 

Author Comment

by:SkizoWalker
ID: 1315486
okay thanx for all answer people
I have anyway find myselft the wayt to Open and close the CD drawer and to check CDRom insertion/Removal .. i just launch a SetTimer procedure of 1200 ms interval , while i check if i have an eror frommy mci device (if an error occured , so -> no disk present) and if no error , then get the new Track status
 
Anyway here are the points

thx also chensu

Greetings , Skiwoka
France

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

688 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