Returns the plug and play identifier string for a given endpoint as an allocated string.
public:
HRESULT GetPnpId(
LPWSTR *ppstrId
)
ppstrId
Type: LPWSTR *
[out] pstrId - The ID of this device
Type: HRESULT
If the method succeeds, it returns S_OK.
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:
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.
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.
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
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#CLASS_01#0001.0001.0001.001.000.000.000.000.000#VID_2068#PID_0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
IMMDeviceEnumerator::EnumAudioEndpoints Method
Header: Declared in mmdeviceapi.h.
Library: Use MMdDevApi.