Introduction to MCI

The Media Control Interface (MCI) provides a convenient, common API that client applications can use for controlling all multimedia hardware. MCI is made up of the following components:

Under Windows NT, the command parsing and dispatching functions reside within winmm.dll. Client applications access these functions by calling mci-prefixed API functions provided by winmm.dll. Applications can also use the MCIWnd window class and its associated messages, which provide a simpler, higher-level interface than the mci-prefixed functions. (The MCI functions and window messages are described in the Win32 SDK.)

Usually when an application calls an MCI function, winmm.dll calls an MCI driver to perform the specified operation. Applications primarily call the mciSendCommand and mciSendString functions. Even when an application uses the MCIWnd window class, it is actually making indirect calls to these two functions. The mciSendCommand and mciSendString functions are described in the Win32 SDK.

When an application calls mciSendCommand, it specifies a device and an MCI command message, which is simply a predefined constant value, such as MCI_PLAY. The mciSendCommand function calls the MCI driver for the specified device and passes the command message. The driver processes the command and returns.

When an application calls mciSendString, it specifies an MCI command string, which is a text string describing the command and device, such as “play videodisc1”. In this case, an MCI command parser searches a set of MCI command tables to verify that the command is valid for the specified device. If the command is valid, the parser converts the command string to a command message, and the message is passed to the appropriate MCI driver. The driver processes the command and returns.

A unique data structure is defined for each MCI command. These MCI data structures have a standardized format and are used for passing information to and from MCI drivers. Applications calling mciSendCommand reference the structures directly. Applications calling mciSendString do not reference the structures. Instead, winmm.dll converts input strings into structure member values. Before the call returns, winmm.dll extracts output values from the structure and converts them to output strings.