How to Address Multiple CDAudio Devices in Windows NT
ID: Q137579
|
The information in this article applies to:
-
Microsoft Win32 Software Development Kit (SDK), versions 3.5, 5.51, 4.0
SUMMARY
To use more than one CDAudio device in Windows 3.1, you had to change the
System.ini file. For more information on this process, please see the
following article in the Microsoft Knowledge Base:
Q82469Using Multiple CD-ROM Drives on One Machine
Now, in Windows NT 3.5 and Windows 95, support for multiple CDAudio devices
has been added to the MCI CDAudio driver. However, the problem now becomes
one of how to address a particular CDAudio device.
MORE INFORMATION
MCI solves the problem of how to control a particular CDAudio device. All
you need to do is open the CDAudio device, specifying the drive letter of
the CD-ROM drive to be used as the element to open. The MCI string syntax
to do this is as follows:
open d: type cdaudio alias cd
In this case, the CD-ROM drive is drive D:
The following code fragment demonstrates the equivalent MCI command syntax
code:
MCI_OPEN_PARMS mciOpen;
TCHAR szElementName[4];
TCHAR szAliasName[32];
DWORD dwFlags;
DWORD dwAliasCount = GetCurrentTime();
DWORD dwRet;
TCHAR chDrive;
chDrive = TEXT("D"); // Use drive D
ZeroMemory( &mciOpen, sizeof(mciOpen) );
mciOpen.lpstrDeviceType = (LPTSTR)MCI_DEVTYPE_CD_AUDIO;
wsprintf( szElementName, TEXT("%c:"), chDrive );
wsprintf( szAliasName, TEXT("CD%lu:"), dwAliasCount );
mciOpen.lpstrElementName = szElementName;
mciOpen.lpstrAlias = szAliasName;
dwFlags = MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE | MCI_OPEN_ALIAS |
MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_WAIT;
dwRet = mciSendCommand(0, MCI_OPEN, dwFlags, (DWORD)(LPVOID)&mciOpen);
if ( dwRet == MMSYSERR_NOERROR ) {
// The device was opened successfully
}
else {
// The device was not opened successfully
}
Additional query words:
3.50 4.00 Windows 95
Keywords :
Version :
Platform :
Issue type :