MCI_STOP
Appearance
This message is sent to stop playback or recording. For video recording, issuing this message stops the process regardless of whether a "TO" position has been reached.
Syntax
param1 ULONG ulParam1; /* Message flags. */ param2 PMCI_GENERIC_PARMS pParam2; /* Pointer to generic structure. */
Parameters
- ulParam1 (ULONG) - input
- This parameter can contain any of the following flags:
- * MCI_NOTIFY — Posts a notification message to the window specified in the `hwndCallback` field of the structure pointed to by `pParam2` when the action completes or an error occurs.
- * MCI_WAIT — Does not return control until the action is completed or an error occurs.
- pParam2 (PMCI_GENERIC_PARMS) - input
- A pointer to the default media control interface (MCI_GENERIC_PARMS) data structure.
Return Value
- rc (ULONG)
- Return codes indicating success or type of failure:
- * MCIERR_SUCCESS — 0 is returned if the function succeeds.
- * MCIERR_INVALID_DEVICE_ID — The device ID is not valid.
- * MCIERR_INSTANCE_INACTIVE — The device ID is currently inactive. Issue MCI_ACQUIREDEVICE to make the device ID active.
- * MCIERR_MISSING_FLAG — A required flag is missing.
- * MCIERR_UNSUPPORTED_FLAG — The given flag is unsupported for this device.
- * MCIERR_INVALID_CALLBACK_HANDLE — The given callback handle is invalid.
- * MCIERR_HARDWARE — Device hardware error.
- * MCIERR_UNSUPPORTED_FUNCTION — Unsupported function.
- * MCIERR_INVALID_FLAG — Flag (`ulParam1`) is invalid.
- * MCIERR_FLAGS_NOT_COMPATIBLE — Flags cannot be used together.
- * MCIERR_INVALID_ITEM_FLAG — Invalid status item flag given.
- * MCIERR_MISSING_ITEM — Missing status item flag.
- * MCIERR_MISSING_PARAMETER — Required parameter is missing.
Remarks
- **Recording:** Once video recording is stopped, it cannot be restarted without overwriting the previous recording.
- **Latency:** If you intend to restart playback or recording with minimal latency, use MCI_PAUSE instead of MCI_STOP.
Related Messages
Example Code
The following code illustrates how to stop an audio or video device during playback or recording and receive notification upon completion.
USHORT usDeviceID;
HWND hwndMyWindow;
MCI_GENERIC_PARMS mciGenericParms; /* Info data structure for command */
/* Assign hwndCallback the handle to the PM Window */
mciGenericParms.hwndCallback = hwndMyWindow;
/* Stop the device */
mciSendCommand( usDeviceID, /* Device ID */
MCI_STOP, /* MCI stop message */
MCI_NOTIFY, /* Flag for this message */
(PVOID) &mciGenericParms, /* Data structure */
0); /* No user parm */