Jump to content

MCI_LOAD

From EDM2

This message is used to load a new file or RIFF chunk into an already opened media device instance.

Syntax

param1
ULONG ulParam1; /* Load flags. */

param2
PMCI_LOAD_PARMS pParam2; /* Pointer to the MCI_LOAD_PARMS data structure. */

Parameters

ulParam1 (ULONG) - input
The following flags can be used. Note that MCI_OPEN_ELEMENT and MCI_OPEN_MMIO are mutually exclusive.
  • MCI_NOTIFY Posts a notification message when the action completes.
  • MCI_WAIT Does not return control until the load action is completed.
  • MCI_OPEN_ELEMENT Specifies that pszElementName contains a file name or compound file element. If the name is NULL or the file doesn't exist, a temporary element is created (equivalent to the `NEW` keyword).
  • MCI_OPEN_MMIO Indicates that pszElementName contains an MMIO handle (hmmio).
Device Extensions
  • MCI_READONLY (Digital Video / Waveform) Opens the file in read-only mode to prevent changes and allow sharing. Disables MCI_SAVE and MCI_RECORD.
pParam2 (PMCI_LOAD_PARMS) - input
A pointer to the MCI_LOAD_PARMS structure.

Returns

rc (ULONG) - returns
  • MCIERR_SUCCESS Command completed successfully.
  • MCIERR_INVALID_DEVICE_ID Invalid device ID.
  • MCIERR_FILE_NOT_FOUND The specified file could not be found.
  • MCIERR_FLAGS_NOT_COMPATIBLE Incompatible flags (e.g., ELEMENT and MMIO together).
  • MCIERR_UNSUPP_SAMPLESPERSEC Hardware cannot support the media's sampling rate.
  • MCIERR_INVALID_MEDIA_TYPE Media format is invalid or unrecognized.

Remarks

When a new media element is loaded, the device settings (such as sampling rate or bits per pel) may change to match the requirements of the new media. If a "new" (temporary) element is created, the device uses its default settings.

For **Video Overlay** devices, `MCI_LOAD` overwrites the image currently in the device element. It also automatically sets several internal image attributes (BITSPERPEL, PELFORMAT, etc.) based on the file content.

Example Code

The following code illustrates how to load a wave file into an existing waveaudio device.

USHORT         usDeviceID;
MCI_LOAD_PARMS mlp;

/* Set up the parameter structure */
mlp.hwndCallback = (HWND) NULL; 
strcpy(mlp.pszElementName, "oinker.wav"); /* File name to load */

/* Load the file */
mciSendCommand( usDeviceID,        /* Device ID                 */
 MCI_LOAD,                         /* MCI load message          */
 MCI_WAIT | MCI_OPEN_ELEMENT,      /* Flags for this message    */
 (PVOID) &mlp,                     /* Data structure            */
 0);                               /* No user parm              */

Related Messages