mciSendString

Syntax

DWORD mciSendString(lpstrCommand, lpstrReturnString, wReturnLength, hCallback)

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

Parameters

LPSTR lpstrCommand

Specifies an MCI command string.

LPSTR lpstrReturnString

Specifies a buffer for return information. If no return information is needed, you can specify NUL for this parameter.

WORD wReturnLength

Specifies the size of the return buffer specified by lpstrReturnString.

HANDLE hCallback

Specifies a handle to a window to call back if “notify” was specified in the command string.

Return Value

Returns zero if the function was successful. Otherwise, it returns error information. The low-order word of the returned DWORD contains the error return value.

To get a textual description of mciSendString return values, pass the return value to mciGetErrorString.

The error returns listed for mciSendCommand also apply to mciSendString. The following error returns are unique to mciSendString:

MCIERR_BAD_CONSTANT

Unknown value for parameter.

MCIERR_BAD_INTEGER

Invalid or missing integer in command.

MCIERR_DUPLICATE_FLAGS

A flag or value was specified twice.

MCIERR_MISSING_COMMAND_STRING

No command was specified.

MCIERR_MISSING_DEVICE_NAME

No device name was specified.

MCIERR_MISSING_STRING_ARGUMENT

A string value was missing from the command.

MCIERR_NEW_REQUIRES_ALIAS

An alias must be used with the “new” device name.

MCIERR_NO_CLOSING_QUOTE

A closing quotation mark is missing.

MCIERR_NOTIFY_ON_AUTO_OPEN

The “notify” flag is illegal with auto-open.

MCIERR_PARAM_OVERFLOW

The output string was not long enough.

MCIERR_PARSER_INTERNAL

Internal parser error.

MCIERR_UNRECOGNIZED_KEYWORD

Unknown command parameter.

See Also

mciExecute, mciGetErrorString, mciSendCommand