How to Address Multiple CDAudio Devices in Windows NT

Last reviewed: October 2, 1995
Article 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:

   ARTICLE-ID: Q82469
   TITLE     : Using 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 reference words: 3.50 4.00 Windows 95
KBCategory: kbmm kbprg kbcode
KBSubcategory: MMCDROM


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.