IDeviceTopology::GetPartById method (devicetopology.h)

The GetPartById method gets a part that is identified by its local ID.

Syntax

HRESULT GetPartById(
  [in]  UINT  nId,
  [out] IPart **ppPart
);

Parameters

[in] nId

The part to get. This parameter is the local ID of the part. For more information, see Remarks.

[out] ppPart

Pointer to a pointer variable into which the method writes the address of the IPart interface of the part object that is identified by nId. Through this method, the caller obtains a counted reference to the interface. The caller is responsible for releasing the interface, when it is no longer needed, by calling the interface's Release method. If the GetPartById call fails, *ppPart is NULL.

Return value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return code Description
E_INVALIDARG
Parameter nId is not a valid local ID.
E_POINTER
Pointer ppPart is NULL.

Remarks

A local ID is a number that uniquely identifies a part among all the parts in a device topology. The IAudioInputSelector::GetSelection and IAudioOutputSelector::GetSelection methods retrieve the local ID of a connected part. The IAudioInputSelector::SetSelection and IAudioOutputSelector::SetSelection methods select the input or output that is connected to a part that is identified by its local ID. When you have a pointer to a part object, you can call the IPart::GetLocalId method to get the local ID of the part.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header devicetopology.h

See also

IAudioInputSelector::GetSelection

IAudioInputSelector::SetSelection

IAudioOutputSelector::GetSelection

IAudioOutputSelector::SetSelection

IDeviceTopology Interface

IPart Interface

IPart::GetLocalId