Solved

Detecting CD Changes

Posted on 1998-05-26
4
314 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
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: …

744 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

12 Experts available now in Live!

Get 1:1 Help Now