IPartsList::GetPart method (devicetopology.h)

The GetPart method gets a part from the parts list.

Syntax

HRESULT GetPart(
  [in]  UINT  nIndex,
  [out] IPart **ppPart
);

Parameters

[in] nIndex

The part number of the part to retrieve. If the parts list contains n parts, the parts are numbered 0 to n– 1. Call the IPartsList::GetCount method to get the number of parts in the list.

[out] ppPart

Pointer to a pointer variable into which the method writes the address of the IPart interface of the part object. Through this method, the caller obtains a counted reference to the IPart interface. The caller is responsible for releasing the interface, when it is no longer needed, by calling the interface's Release method. If the GetPart 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 nIndex is out of range.
E_POINTER
Pointer ppPart is NULL.

Remarks

For a code example that calls the GetPart method, see the implementation of the SelectCaptureDevice function in Device Topologies.

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

IPart Interface

IPartsList Interface

IPartsList::GetCount