The following code illustrates how to open a waveaudio device instance by specifying SPEECH.WAV.

/* Open a waveaudio device context, specifying the element
   "speech.wav".

ULONG          rc;
MCI_OPEN_PARMS mop;

mop.hwndCallback = (HWND) NULL;      /* N/A - we're waiting       */
mop.usDeviceID = (USHORT) NULL;      /* This is returned          */
mop.pszDeviceType = (PSZ) NULL;      /* using default device type */
mop.pszElementName = (PSZ) "speech.wav"
                                     /* File name to open         */
rc = mciSendCommand( 0,
    MCI_OPEN,                        /* MCI open message          */
    MCI_WAIT | MCI_OPEN_ELEMENT |
    MCI_OPEN_SHAREABLE,              /* Flags for this message    */
    (ULONG) &mop,                    /* Data structure            */
    0);                              /* No user parm              */
if (LOUSHORT(rc) == MCIERR_SUCCESS)
  {
   usDeviceID = mop.usDeviceID;      /* Return device ID          */
  }


[Back] [Next]