IDeviceTopology::GetSubunit method

The GetSubunit method gets the subunit that is specified by a subunit number.

Syntax


HRESULT GetSubunit(
  [in]  UINT     nIndex,
  [out] ISubunit **ppSubunit
);

Parameters

nIndex [in]

The subunit number. If a device topology contains n subunits, the subunits are numbered from 0 to n– 1. To get the number of subunits in the device topology, call the IDeviceTopology::GetSubunitCount method.

ppSubunit [out]

Pointer to a pointer variable into which the method writes the address of the ISubunit interface of the subunit object. 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 GetSubunit call fails, *ppSubunit 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 codeDescription
E_INVALIDARG

Parameter nIndex is out of range.

E_POINTER

Pointer ppSubunit is NULL.

 

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Devicetopology.h

See also

IDeviceTopology Interface
IDeviceTopology::GetSubunitCount
ISubunit Interface

 

 

Show: