Solved

Detecting CD Changes

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

626 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