System-Intercepted Device Messages

The following Windows multimedia functions provide a way for callers to pass messages to legacy audio devices:

Some of these device messages are handled directly by the device driver, and some are handled by the system on behalf of the device.

This section discusses only messages that are intercepted by the system and handled without ever being passed to the device driver. System-intercepted messages can obtain the preferred device for voice communications or general audio usage. In addition, system-intercepted messages can provide the following information about a particular device:

  • The device interface name

    For information about device interface names, see Introduction to Device Interfaces.

  • The device's Plug and Play devnode number

    For information about devnodes, see Device Tree.

  • Whether the device can be used by a mapper

    A mapper selects an appropriate device by mapping an application's requirements to one of the available devices in the system. For more information about mappers, see the Microsoft Windows SDK documentation.

For information about other types of device messages, see the Windows SDK documentation.

An XxxMessage function has the following syntax:

DWORD XxxMessage(
<device ID>,
    UINT  uMsg,
    DWORD_PTR  dwParam1,
    DWORD_PTR  dwParam2
    );

The first parameter is a device ID. The auxOutMessage function definition specifies this parameter to be of type UINT, as expected. However, in the case of waveInMessage, waveOutMessage, midiInMessage, midiOutMessage, or mixerMessage, the caller must cast the device ID to handle type HWAVEIN, HWAVEOUT, HMIDIIN, HMIDIOUT, or HMIXER, respectively. Note that if the caller supplies a valid handle instead of a device ID for this parameter, the function fails and returns error code MMSYSERR_NOSUPPORT.

The uMsg parameter specifies a message value (for example, DRV_QUERYDEVICEINTERFACE). For a list of driver-specific messages, see header file Mmddk.h.

The meaning of parameters dwParam1 and dwParam2 depends on the message. For example, a particular message might require that dwParam1 be a ULONG value; the caller must cast this value to type DWORD_PTR to satisfy the function definition.

The function returns MMERR_NOERROR if the call succeeds, or an error status code if it does not.

For more information about the XxxMessage functions, see the Windows SDK documentation.

Header file Mmddk.h defines the following system-intercepted device messages:

DRV_QUERYDEVICEINTERFACE

For more information, see Obtaining a Device Interface Name.

DRV_QUERYDEVICEINTERFACESIZE

For more information, see Obtaining a Device Interface Name.

DRV_QUERYDEVNODE

Queries for a device's devnode number.

DRV_QUERYMAPPABLE

Queries whether a device can be used by a mapper.

DRVM_MAPPER_CONSOLEVOICECOM_GET

For more information, see Preferred Voice-Communications Device ID.

DRVM_MAPPER_PREFERRED_GET

For more information, see Accessing the Preferred Device ID.