Jump to content

MCI_RECORD

From EDM2

This message causes the device to start recording. Before you send this message, it is recommended that you issue MCI_ACQUIREDEVICE with the MCI_EXCLUSIVE_INSTANCE flag set. This will lock the device context and prevent it from being made inactive.

Digital Video Specific
This message initiates real-time recording of motion video with simultaneous audio capture. Any options, such as frame rate, quality, and so on, in effect at the time recording starts are applied to the recording and cannot be changed during the recording process. If changes to recording options or parameters are attempted during recording, MCIERR_INVALID_MODE is returned. All recording operations entirely replace the contents of the device element at the starting location. MCI_FROM is not supported and MCI_TO is used only as an indication of the length of the recording to be performed.

Syntax

param1
ULONG ulParam1; /* Record flags. */

param2
PMCI_RECORD_PARMS pParam2; /* Pointer to the MCI_RECORD_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_FROM Specifies the starting position in the ulFrom field of the parameter structure. Defaults to the current location if omitted.
  • MCI_TO Specifies the ending position in the ulTo field. Recording continues until a stop or pause is received if omitted.
  • MCI_RECORD_INSERT Newly recorded data is inserted into existing data. (Default for some devices).
  • MCI_RECORD_OVERWRITE Newly recorded data replaces existing data at the target location. (Default for Waveaudio and non-insert devices).
pParam2 (PMCI_RECORD_PARMS) - input
A pointer to the MCI_RECORD_PARMS structure.

Returns

rc (ULONG) - returns
  • MCIERR_SUCCESS Recording initiated successfully.
  • MCIERR_INSTANCE_INACTIVE The device is inactive. Use MCI_ACQUIREDEVICE.
  • MCIERR_OUTOFRANGE The ulFrom position is greater than the media size.
  • MCIERR_TARGET_DEVICE_FULL The storage medium (e.g., disk) is full.
  • MCIERR_FILE_NOT_FOUND No file has been loaded for recording.

Remarks

Recording units (FROM/TO) are determined by the currently set time format (see MCI_SET).

Digital Video Specifics

  • Initiates real-time motion video and audio capture.
  • Options (frame rate, quality) cannot be changed once recording starts.
  • **MCI_FROM is not supported.**
  • All recording operations replace existing content starting from the current location.

Waveaudio Specifics

  • Although Waveaudio supports insertion, the default behavior for the `MCI_RECORD` command is **overwrite**.

Example Code

The following example starts recording at the 5-second mark and overwrites data until the 10-second mark.

 USHORT            usDeviceID;
 MCI_RECORD_PARMS  mrp;

 /* Assumes time format is already set to milliseconds */
 mrp.hwndCallback = hwndMyWindow;
 mrp.ulFrom       = 5000;  /* Start at 5 seconds */
 mrp.ulTo         = 10000; /* End at 10 seconds   */

 mciSendCommand(usDeviceID,
                MCI_RECORD,
                MCI_NOTIFY | MCI_FROM | MCI_TO | MCI_RECORD_OVERWRITE,
                (PVOID)&mrp,
                0);

Related Messages