Morning all,

Just beginning playing with MCI and I have seen a few tutorials on the subject,but I have one question Ican't find the answer to:

How to you control a specific CD or DVD drive if there is more than one on a computer. I realise that you open a cdaudio device, but how do you know if the device opened is the one the user put the CD/DVD in ?What if the system opens the 'empty' drive ? Or what if both drives are loaded with cd's (audio) but you only want to control one of them ? I can't seem to find the answer to my questions in my SDK docs.

By the way, I lied, that was more than one question


Posted on 2002-08-08 02:28:12 by CodeBug
I believe I found it in MSDN.
Anyway, this should work:


CdName1 db "d:",0
CdName2 db "e:",0
CdAlias1 db "CD1:",0
CdAlias2 db "CD2:",0

mov mciOpen.lpstrAlias,offset CdAliasX
mov mciOpen.lpstrElementName,offset CdNameX
invoke mciSendCommand,0,MCI_OPEN,MCI_OPEN_ELEMENT+\
Posted on 2002-08-08 05:39:21 by goofee
For your other questions you might want to consider reading MSDN on
mciSendCommand and the different commands you can use. It's all in there.
Open drive doors equal no CD inserted (that's what I found, anyhow).
Posted on 2002-08-08 05:46:49 by goofee
hi !

Window Store data in the registry like the Default cd drive.

to access it use this subkey : "System\CurrentControlSet\control\MediaResources\mci\cdaudio"
key : "Default Drive"

with the function GetLogicalDrives & GetDriveType you can know the available cdrom in your computer.

then to know if it's a CD or a CDrom you can retrieve with a command the total number of track.

In general, CDRom have 1 track and CDAudio more than 1.

To Open a particular Cd Drive just set in the registry the default cd letter and open the MCI CDAudio interface.

and if the system open the empty drive it return an error message (See int The Msnd Library MciSendString & MciSendCommand and on the net).

Good Learning ! :)
Posted on 2002-08-08 07:43:49 by kylekiller
Thanks Kylekiller and goofee.. I have something to think about now.

Seems as though it's not as straight forward as using MCi commands


Posted on 2002-08-08 09:48:30 by CodeBug