MCI_DELETE
This message removes the specified range of data from the device file. The media position after a delete operation is the MCI_FROM position if used, or the previous position if MCI_FROM is not used.
Syntax
param1 ULONG ulParam1; /* Flags for delete operation. */ param2 PMCI_EDIT_PARMS pParam2; /* Pointer to the MCI_EDIT_PARMS data structure. */
Parameters
- ulParam1 (ULONG) - input
- This parameter can contain any of the following flags:
- MCI_NOTIFY A notification message will be posted to the window specified in the hwndCallback parameter of the data structure pointed to by the pParam2 parameter. The notification will be posted when the action indicated by this message is completed or when an error occurs.
- MCI_WAIT Control is not to be returned until the action indicated by this message is completed or an error occurs.
- MCI_FROM The beginning position of a delete. The position of the media is either the position specified in the ulFrom field or the current position if MCI_FROM is not specified.
- MCI_TO The ending position of a delete operation. If MCI_TO is not specified, the end of the file is assumed to be the end of the range to be deleted.
- pParam2 (PMCI_EDIT_PARMS) - input
- A pointer to the MCI_EDIT_PARMS data structure.
Returns
- rc (ULONG) - returns
- Return codes indicating success or type of failure:
- MCIERR_SUCCESS Delete was successful.
- MCIERR_CANNOT_WRITE The file was not opened with write access.
- MCIERR_OUTOFRANGE The units are out of the range.
- MCIERR_INVALID_DEVICE_ID The device ID is not valid.
- MCIERR_MISSING_PARAMETER Required parameter is missing.
- MCIERR_INVALID_FLAG Flag is invalid (ulParam1).
- MCIERR_UNSUPPORTED_FLAG Given flag is unsupported for this device.
- 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_OUT_OF_MEMORY Insufficient memory to perform the operation requested.
Remarks
Neither a user-defined buffer nor the clipboard is used by this command. If neither MCI_FROM nor MCI_TO are specified, the range to be deleted is assumed to be from the current position to the end of the file. The difference between MCI_FROM and MCI_TO must be greater than zero, otherwise an error is returned.
The units of the MCI_FROM and MCI_TO parameters are interpreted in the currently selected time format.
- Example of interpretation:**
If a multimedia element is composed of samples and a file has 100 samples (numbered 0 to 99), and the from position is 25 with the to position at 30, MCI_DELETE will delete samples 25, 26, 27, 28, and 29. After the delete, the current position of the media would be at sample 25.
Edited Audio/Video Interleaved (AVI) movie files cannot always be saved with their original name after the delete operation. If the clipboard contains a reference to data that would be erased during saving or if another instance of the digital video device has a pending paste operation which depends on this data, the file cannot be saved unless a new file name has been provided. If a new file name is not provided, MMIOERR_NEED_NEW_FILENAME is returned by the AVI I/O procedure and a temporary file is created to save the edited movie.
> **Note:** AVI is the only video file format supporting editing commands.
Example Code
USHORT usDeviceID;
MCI_EDIT_PARMS mep;
mep.hwndCallback = hwndMyWindow;
mep.ulFrom = 0;
mep.ulTo = 5000; /* Current time format is milliseconds */
/* Delete first five seconds of file */
mciSendCommand( usDeviceID,
MCI_DELETE,
MCI_NOTIFY | MCI_FROM | MCI_TO,
&mep,
0 );