MCI_UNDO
Appearance
This message undoes the operation most recently performed by a cut, paste, or delete command.
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 MCI_GENERIC_PARMS data structure.
Return Value
- rc (ULONG)
- Return codes indicating success or type of failure:
- * MCIERR_SUCCESS — The UNDO was successful.
- * MCIERR_INVALID_DEVICE_ID — The device ID is not valid.
- * MCIERR_INVALID_FLAG — Flag (`ulParam1`) is invalid.
- * MCIERR_INSTANCE_INACTIVE — The device is currently inactive. Issue MCI_ACQUIREDEVICE to make the device context active.
- * MCIERR_INVALID_CALLBACK_HANDLE — Given callback handle is invalid.
- * MCIERR_CANNOT_UNDO — Undo is not possible in the current state (e.g., no actions in the undo stack).
Remarks
- **Positioning:** After a successful undo operation, the media position is reset to the beginning of the media.
- **Undo Stack:** Undo is unlimited. However, performing a save operation clears the undo history; any previous editing actions (cut, delete, paste) can no longer be undone.
- **Interruption:** If an undo command is issued while another operation (like playback) is in progress, that operation is aborted, and an `MM_MCINOTIFY` message is sent.
- **Support:** Not all devices support this command. Use MCI_GETDEVCAPS to check for `MCI_GETDEVCAPS_CAN_UNDO`.
Related Messages
Example Code
The following code illustrates undoing the last editing operation.
USHORT usDeviceID;
MCI_GENERIC_PARMS mep;
mep.hwndCallback = hwndMyWindow;
mciSendCommand( usDeviceID,
MCI_UNDO,
MCI_NOTIFY,
(PVOID) &mep,
0 );