Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Command Messages

The command-message interface is designed to be used by applications requiring a C-language interface to control multimedia devices. It uses a message-passing paradigm to communicate with MCI devices. You can send a command by using the mciSendCommand function.

The mciSendCommand function returns zero if successful. If the function fails, the low-order word of the return value contains an error code. You can pass this error code to the mciGetErrorString function to get a text description of the error.

Syntax of Command Messages

MCI command messages consist of the following elements:

  • A constant message value
  • A structure containing parameters for the command
  • A set of flags specifying options for the command and validating fields in the parameter block

The following example uses the mciSendCommand function to send the MCI_ PLAY command to the device identified by a device identifier.



mciSendCommand(wDeviceID,            // device identifier 
    MCI_PLAY,                        // command message 
    0,                               // flags 
    (DWORD)(LPVOID) &mciPlayParms);  // parameter block 


The device identifier given in the first parameter is retrieved when the device is opened using the MCI_ OPEN command. The last parameter is the address of an MCI_ PLAY_ PARMS structure, which might contain information about where to begin and end playback. Many MCI command messages use a structure to contain parameters of this kind. The first member of each of these structures identifies the window that receives an MM_ MCINOTIFY message when the operation finishes.

 

 

Show: