MCI_SAVE
Appearance
This message saves the current file or device element to storage.
Syntax
param1 ULONG ulParam1; /* Message flags. */ param2 PMCI_SAVE_PARMS pParam2; /* Pointer to the MCI_SAVE_PARMS structure. */
Parameters
- ulParam1 (ULONG) - input
- The following flags can be used:
- MCI_NOTIFY Posts a notification message when the action completes.
- MCI_WAIT Does not return control until the action is completed.
- MCI_SAVE_FILE The `pszFileName` field of the parameter structure contains the destination file name. If omitted, the original file opened or the most recently loaded file name is assumed.
- Digital Video Extensions
-
- MCI_DGV_SAVE_VIDEO_FILE Saves the motion video device element (default).
- MCI_DGV_SAVE_IMAGE_FILE Saves the still image device element.
- pParam2 (PMCI_SAVE_PARMS) - input
- A pointer to the MCI_SAVE_PARMS structure.
Returns
- rc (ULONG) - returns
-
- MCIERR_SUCCESS Command completed successfully.
- MCIERR_INVALID_DEVICE_ID Invalid device ID given.
- MCIERR_INSTANCE_INACTIVE The device is inactive. Use MCI_ACQUIREDEVICE.
- MCIERR_TARGET_DEVICE_FULL Target storage is full.
- MCIERR_FILE_NOT_FOUND Current element has no name and none was provided.
- MMIOERR_NEED_NEW_FILE_NAME The file cannot be saved with its original name because other processes have outstanding paste operations using this data.
- MMIOERR_CLIPBRD_ACTIVE The file cannot be saved with its original name because the clipboard contains an active reference to its data.
Remarks
If `MCI_SAVE_FILE` is specified, the file named in `pszFileName` becomes the currently loaded element. This command is only supported by devices that return TRUE to the `MCI_GETDEVCAPS_CAN_SAVE` query.
Digital Video Specifics
An edited AVI movie file cannot always be saved with its original name if the clipboard or another device instance has pending operations depending on the current data. In such cases, `MMIOERR_NEED_NEW_FILE_NAME` is returned, and a temporary file may be created by the AVI I/O procedure to prevent data loss.
Example Code
The following code illustrates how to save a device element to a new file and receive notification upon completion.
USHORT usDeviceID;
HWND hwndMyWindow;
MCI_SAVE_PARMS msp;
/* Assign hwndCallback the handle to the PM Window */
msp.hwndCallback = hwndMyWindow;
/* File name to save */
msp.pszFileName = (PVOID) "movie.avi";
mciSendCommand( usDeviceID, /* Device ID */
MCI_SAVE, /* MCI save message */
MCI_NOTIFY | MCI_SAVE_FILE,
/* Flags for this message */
(PVOID) &msp, /* Data structure */
0); /* No user parm */