Compartilhar via


IDeviceTopology::GetPartById

Previous Next

IDeviceTopology::GetPartById

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

HRESULT GetPartById(
  UINT  nId,
  IPart  **ppPart
);

Parameters

nId

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

ppPart

[out]  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

Client: Windows Vista

Header: Include Devicetopology.h.

See Also

Previous Next