Share via

mciSendString function

The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string.


MCIERROR mciSendString(
   LPCTSTR lpszCommand,
   LPTSTR  lpszReturnString,
   UINT    cchReturn,
   HANDLE  hwndCallback


  • lpszCommand
    Pointer to a null-terminated string that specifies an MCI command string. For a list, see Multimedia Command Strings.

  • lpszReturnString
    Pointer to a buffer that receives return information. If no return information is needed, this parameter can be NULL.

  • cchReturn
    Size, in characters, of the return buffer specified by the lpszReturnString parameter.

  • hwndCallback
    Handle to a callback window if the "notify" flag was specified in the command string.

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 error values, see MCIERR Return Values.

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


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

mciSendStringW (Unicode) and mciSendStringA (ANSI)

See also


MCI Functions

Command Strings