mciSendCommand

Syntax

DWORD mciSendCommand(wDeviceID, wMessage, dwParam1, dwParam2)

This function sends a command message to the specified MCI device.

Parameters

WORD wDeviceID

Specifies the device ID of the MCI device to receive the command. This parameter is not used with the MCI_OPEN command.

WORD wMessage

Specifies the command message.

DWORD dwParam1

Specifies flags for the command.

DWORD dwParam2

Specifies a pointer to a parameter block for the command.

Return Value

Returns zero if the function was successful. Otherwise, it returns error information. The low-order word of the returned DWORD is the error return value. If the error is device-specific, the high-order word contains the driver ID; otherwise the high-order word is zero.

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

Error values that are returned when a device is being opened are listed with the MCI_OPEN message. In addition to the MCI_OPEN error returns, this function can return the following values:

MCIERR_BAD_TIME_FORMAT

Illegal value for time format.

MCIERR_CANNOT_USE_ALL

The device name “all” is not allowed for this command.

MCIERR_CREATEWINDOW

Could not create or use window.

MCIERR_DEVICE_LOCKED

The device is locked until it is closed automatically.

MCIERR_DEVICE_NOT_READY

Device not ready.

MCIERR_DEVICE_TYPE_REQUIRED

The device name must be a valid device type.

MCIERR_DRIVER

Unspecified device error.

MCIERR_DRIVER_INTERNAL

Internal driver error.

MCIERR_FILE_NOT_FOUND

Requested file not found.

MCIERR_FILE_NOT_SAVED

The file was not saved.

MCIERR_FILE_READ

A read from the file failed.

MCIERR_FILE_WRITE

A write to the file failed.

MCIERR_FLAGS_NOT_COMPATIBLE

Incompatible parameters were specified.

MCIERR_HARDWARE

Hardware error on media device.

MCIERR_INTERNAL

Internal error.

MCIERR_INVALID_DEVICE_ID

Invalid device ID.

MCIERR_INVALID_DEVICE_NAME

The device is not open or is not known.

MCIERR_INVALID_FILE

Invalid file format.

MCIERR_MULTIPLE

Errors occurred in more than one device.

MCIERR_NO_WINDOW

There is no display window.

MCIERR_NULL_PARAMETER_BLOCK

Parameter block pointer was NULL.

MCIERR_OUT_OF_MEMORY

Not enough memory for requested operation.

MCIERR_OUTOFRANGE

Parameter value out of range.

MCIERR_UNNAMED_RESOURCE

Attempt to save unnamed file.

MCIERR_UNRECOGNIZED_COMMAND

Unknown command.

MCIERR_UNSUPPORTED_FUNCTION

Action not available for this device.

The following additional return values are defined for MCI sequencers:

MCIERR_SEQ_DIV_INCOMPATIBLE

Set Song Pointer incompatible with SMPTE files.

MCIERR_SEQ_PORT_INUSE

Specified port is in use.

MCIERR_SEQ_PORT_MAPNODEVICE

Current map uses non-existent device.

MCIERR_SEQ_PORT_MISCERROR

Miscellaneous error with specified port.

MCIERR_SEQ_PORT_NONEXISTENT

Specified port does not exist.

MCIERR_SEQ_PORTUNSPECIFIED

No current MIDI port.

MCIERR_SEQ_TIMER

Timer error.

The following additional return values are defined for MCI waveform audio devices:

MCIERR_WAVE_INPUTSINUSE

No compatible waveform recording device is free.

MCIERR_WAVE_INPUTSUNSUITABLE

No compatible waveform recording devices.

MCIERR_WAVE_INPUTUNSPECIFIED

Any compatible waveform recording device may be used.

MCIERR_WAVE_OUTPUTSINUSE

No compatible waveform playback device is free.

MCIERR_WAVE_OUTPUTSUNSUITABLE

No compatible waveform playback devices.

MCIERR_WAVE_OUTPUTUNSPECIFIED

Any compatible waveform playback device may be used.

MCIERR_WAVE_SETINPUTINUSE

Set waveform recording device is in use.

MCIERR_WAVE_SETINPUTUNSUITABLE

Set waveform recording device is incompatible with set format.

MCIERR_WAVE_SETOUTPUTINUSE

Set waveform playback device is in use.

MCIERR_WAVE_SETOUTPUTUNSUITABLE

Set waveform playback device is incompatible with set format.

Comments

Use the MCI_OPEN command to obtain the device ID specified by wDeviceID.

See Also

mciGetErrorString, mciSendString