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   



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


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


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


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

Return Values

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 mciSendString return values, pass the return value to the mciGetErrorString function.


**  Windows NT/2000/XP:** Included in Windows NT 3.1 and later.
**  Windows 95/98/Me:** Included in Windows 95 and later.
**  Header:** Declared in Mmsystem.h; include Windows.h.
**  Library:** Use Winmm.lib.
**  Unicode:** Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

MCI, MCI Functions, Command Strings, mciGetErrorString