MCI_PAUSE
Appearance
The `MCI_PAUSE` message is used to suspend the current playback or recording operation on a media device.
Syntax
param1 ULONG ulParam1; /* Pause flags. */ param2 PMCI_GENERIC_PARMS pParam2; /* Pointer to the MCI_GENERIC_PARMS structure. */
Parameters
- ulParam1 (ULONG) - input
- The following flags can be used:
- MCI_NOTIFY Posts a notification message to the window specified in hwndCallback when the pause action completes or an error occurs.
- MCI_WAIT Does not return control until the device has actually paused.
- pParam2 (PMCI_GENERIC_PARMS) - input
- A pointer to the MCI_GENERIC_PARMS data structure.
Returns
- rc (ULONG) - returns
-
- MCIERR_SUCCESS Command completed successfully.
- MCIERR_INVALID_DEVICE_ID Invalid device ID.
- MCIERR_INSTANCE_INACTIVE The device is currently inactive; use MCI_ACQUIREDEVICE to reactivate.
- MCIERR_UNSUPPORTED_FUNCTION The device does not support pausing.
- MCIERR_INVALID_CALLBACK_HANDLE The provided callback handle is invalid.
Remarks
To resume a paused operation, use the MCI_RESUME message. This returns the device to its previous state (playback or recording) using the parameters that were in effect before the pause.
If you issue an MCI_PLAY or MCI_RECORD command while the device is paused, the previous operation is **superseded**. The device will begin the new action using the "from" and "to" parameters provided in the new message.
Example Code
The following example illustrates how to pause a device and request notification when the operation is completed.
#define UP_PAUSE 1
USHORT usDeviceID;
HWND hwndMyWindow;
MCI_GENERIC_PARMS mciGenericParms;
/* Assign the handle to the window that will receive the notification */
mciGenericParms.hwndCallback = hwndMyWindow;
/* Send the pause command */
mciSendCommand(usDeviceID, /* Device ID */
MCI_PAUSE, /* MCI pause message */
MCI_NOTIFY, /* Flags for this message */
(PVOID) &mciGenericParms, /* Data structure */
UP_PAUSE); /* User parameter for notify */