Solved

Detecting CD Changes

Posted on 1998-05-26
4
319 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
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
tma050898 earned 100 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.

830 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