The following example illustrates how to retrieve a device ID.

     CHAR szBuffer[128];              /* Buffer for the string command */
     USHORT usDeviceID;               /* Return device ID              */

     strcpy(szBuffer,"open bell.wav alias wav1 wait");
                                            /* String command to open  */
                                            /* a wav file              */

     mciSendString ((PSZ)szBuffer,   /* Open a wav file                */
                     NULL,           /* No return message              */
                     0,              /* No return message length       */
                     0,              /* No handle to callback          */
                     0);             /* No notify parameter            */


    usDeviceID = mciGetDeviceID((PSZ) "wav1");
                                     /* Returns device ID              */
                                     /* Assigned on the alias "wav1"   */


[Back] [Next]