Share via

mciSendCommand function

The mciSendCommand function sends a command message to the specified MCI device.


MCIERROR mciSendCommand(
   UINT        uMsg,
   DWORD_PTR   fdwCommand,
   DWORD_PTR   dwParam


  • IDDevice
    Device identifier of the MCI device that is to receive the command message. This parameter is not used with the MCI_OPEN command message.

  • uMsg
    Command message. For a list, see Multimedia Commands.

  • fdwCommand
    Flags for the command message.

  • dwParam
    Pointer to a structure that contains parameters for the command message.

Return value

Returns zero if successful or an error otherwise. The low-order word of the returned DWORD value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible return values, see MCIERR Return Values.

To retrieve a text description of return values, pass the return value to the mciGetErrorString function.


Error values that are returned when a device is being opened are listed with the MCI_OPEN command message. In addition to the MCI_OPEN error return values, this function can return the values listed in MCIERR Return Values.

Use MCI_OPEN to obtain the device identifier specified by the IDDevice parameter.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Mmsystem.h (include Windows.h)





Unicode and ANSI names

mciSendCommandW (Unicode) and mciSendCommandA (ANSI)

See also


MCI Functions

Command Messages