The Item method retrieves a pointer to the specified item in the device collection.
public:
HRESULT Item(
UINT nDevice,
IMMDevice **ppDevice
)
nDevice
Type: UINT
[in]
The device number. If the collection contains n devices, the devices are numbered 0 to n– 1.
ppDevice
Type: IMMDevice **
[out]
Pointer to a pointer variable into which the method writes the address of the IMMDevice interface of the specified item in the device collection. 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 Item call fails, ppDevice* is **NULL.
Type: HRESULT
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_POINTER | Parameter ppDevice is NULL. |
| E_INVALIDARG | Parameter nDevice is not a valid device number. |
Refer to WASAPI error codes.
This method retrieves a pointer to the IMMDevice interface of the specified item in the device collection. Each item in the collection is an endpoint object that represents an audio endpoint device. The caller selects a device from the device collection by specifying the device number. For a collection of n devices, valid device numbers range from 0 to n– 1. To obtain a count of the devices in a collection, call the IMMDeviceCollection::GetCount method.
For a code example that calls the Item method, see Device Properties.
Header: Declared in mmdeviceapi.h.
Library: Use MMDevApi.lib.