The following code illustrates how to cue a device instance for playback and wait for completion.
/* Cue the device for playback (output), and wait for completion */
USHORT usDeviceID;
HWND hwndMyWindow;
MCI_GENERIC_PARMS mciGenericParms; /* Generic message
parms structure */
/* Assign hwndCallback the handle to the PM window */
mciGenericParms.hwndCallback = hwndMyWindow;
mciSendCommand( usDeviceID, /* Device ID */
MCI_CUE, /* MCI cue message */
MCI_WAIT | MCI_CUE_OUTPUT, /* Standard flags */
(PVOID)&mciGenericParms, /* Generic structure */
0 ); /* No user parm */