Obtaining a Device Interface Name

In Windows Me, and Windows 2000 and later, the Windows multimedia functions waveInMessage, waveOutMessage, midiInMessage, midiOutMessage, and mixerMessage can retrieve the device interface name of a device. This information is useful to application programs that need to identify the device outside of the waveIn, waveOut, midiIn, midiOut, or mixer API. Within one of these APIs, a device ID is sufficient.

The Plug and Play manager generates a device interface name to uniquely identify each device that it enumerates. An application should treat the string containing a device interface name as opaque. For more information about device interfaces, see Introduction to Device Interfaces.

The header file Mmddk.h defines two message constants for the purpose of obtaining device interface names:

DRV_QUERYDEVICEINTERFACESIZE

DRV_QUERYDEVICEINTERFACE

The first message obtains the size in bytes of the buffer needed to hold the string containing the device interface name. The second message retrieves the name string in a buffer of the required size.

The system intercepts and handles the DRV_QUERYDEVICEINTERFACESIZE and DRV_QUERYDEVICEINTERFACE messages without sending the messages to the device driver.

The first parameter to the xxxMessage function is the device ID, which the caller must cast to the appropriate handle type: HWAVEIN, HWAVEOUT, HMIDIIN, HMIDIOUT, or HMIXER. For more information about the xxxMessage functions, see System-Intercepted Device Messages.