IDeviceTopology::GetSubunit method (devicetopology.h)
The GetSubunit method gets the subunit that is specified by a subunit number.
HRESULT GetSubunit( [in] UINT nIndex, [out] ISubunit **ppSubunit );
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.
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.
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.
||Parameter nIndex is out of range.|
||Pointer ppSubunit is NULL.|
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|