MCI Functions, Macros, and Messages

Most MCI applications use the mciSendString and mciSendCommand functions dozens of times. MCI provides some other useful functions that your application will use less frequently.

The device identifier required by most MCI commands is typically retrieved in a call to the open (MCI_OPEN) command. If you need a device identifier but do not want to open the device — for example, if you want to query the capabilities of the device before taking any other action — you can call the mciGetDeviceID function.

The mciGetCreatorTask function allows your application to use a device identifier to retrieve a handle to the task that created that identifier.

You can use the mciGetYieldProc and mciSetYieldProc functions to assign and retrieve the address of the callback function associated with the "wait" (MCI_WAIT) flag.

The mciGetErrorString function retrieves a string that describes an MCI error value. Each string that MCI returns, whether data or an error description, is a maximum of 128 characters. Dialog box fields that are smaller than 128 characters will truncate the longer strings returned by MCI. For more information about these strings, see MCIERR Return Values.

The MCI macros are tools you can use to create and disassemble values that specify time formats. These time formats are used in many MCI commands. The formats acted on by the macros are hours/minutes/seconds (HMS), minutes/seconds/frames (MSF), and tracks/minutes/seconds/frames (TMSF). The following table lists the macros and their descriptions.

Macro Description
MCI_HMS_HOUR Retrieves the hours component from an HMS value.
MCI_HMS_MINUTE Retrieves the minutes component from an HMS value.
MCI_HMS_SECOND Retrieves the seconds component from an HMS value.
MCI_MAKE_HMS Creates an HMS value.
MCI_MAKE_MSF Creates an MSF value.
MCI_MAKE_TMSF Creates a TMSF value.
MCI_MSF_FRAME Retrieves the frames component from an MSF value.
MCI_MSF_MINUTE Retrieves the minutes component from an MSF value.
MCI_MSF_SECOND Retrieves the seconds component from an MSF value.
MCI_TMSF_FRAME Retrieves the frames component from a TMSF value.
MCI_TMSF_MINUTE Retrieves the minutes component from a TMSF value.
MCI_TMSF_SECOND Retrieves the seconds component from a TMSF value.
MCI_TMSF_TRACK Retrieves the tracks component from a TMSF value.

MCI also provides two messages: MM_MCINOTIFY and MM_MCISIGNAL. The MM_MCINOTIFY message notifies an application of the outcome of an MCI command whenever that command specifies the "notify" (MCI_NOTIFY) flag. The MM_MCISIGNAL message is specific to digital-video devices; it notifies the application when a specified position is reached.

Show: