IMMXboxDevice::GetPnpId Method

Returns the plug and play identifier string for a given endpoint as an allocated string.

Syntax

public:
HRESULT GetPnpId(
         LPWSTR *ppstrId
)  

Parameters

ppstrId
Type: LPWSTR *

[out] pstrId - The ID of this device

Return value

Type: HRESULT 

If the method succeeds, it returns S_OK.

Remarks

GetPnpId is used after calling the EnumAudioEndpoints method to further identify a device type. The call to EnumAudioEndpoints specifies the type of audio endpoints to return (eRender, eCapture, or eALL). The call to GetPnpId can then be used to identify the particalur type of device within the group specified in the call to EnumAudioEndpoints. For example, to identify a USB microphone you would perform the following steps:

  1. Call EnumAudioEndpoints specifying eCapture.
  2. Call GetPnpId for each of the devices in the set returned by EnumAudioEndpoints.
  3. Check the string returned by EnumAudioEndpoints for “USB”.
  4. To check for a particular type of USB microphone, examine the hardware IDs (VID_, and PID_) in the string.

Note IDs returned by GetPnpId are static, so an ID obtained using GetPnpId during development can be used later to identify that device type.

The caller is responsible for freeing *pstrId using CoTaskMemFree.

ID Format

The returned ID consist of a leading device type string followed by additional values separated with #:

DeviceType[#AdditionInfo1][#AdditionalInfo2][#VID_*][#PID_*][#{Device specific GUID}\global]  

Only the device type string is gauranteed to be present in the format string, all other values may present on some devices and absent on others. In addition, order of values after device type is not gauranteed to be the same for different devices.

DeviceType
  Used to determine the type of device. For example USB devices will start with USB.

VID_*
  Vendor hardware ID.

PID_*
  Product hardware ID.

GUID
  The device specific GUID uniquely identifies the specific device.

Example IDs

Capture Devices

Headset Controller:

XboxControllerCapture#1#2#VID_10F5#PID_0210#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global  

Kinect Microphone:

POSTMEC#0#0#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global  

Render Devices

HD Audio:

HDMIOut#render#0#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global  

Headset Controller:

XboxControllerRender#1#2#VID_10F5#PID_0210#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global  

USB Microphone
USB#CLASS_01#0001.0001.0001.001.000.000.000.000.000#VID_2068#PID_0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global  

See also

IMMXboxDevice Members

IMMXboxDevice

IMMDeviceEnumerator::EnumAudioEndpoints Method

Requirements

Header: Declared in mmdeviceapi.h.

Library: Use MMdDevApi.