You obtain this interface by taking the value of the IUsbMonitor.Devices property and use to enumerate the installed USB devices. There are two ways for using this interface. You can get the Count
property value to get the number of devices in the collection and then use the default Item property to get the IDevice interface for each device in a collection.
Another way of enumerating the devices in the collection is to take the value of the _NewEnum
property to get the object exposing the IEnumVARIANT
interface and use its properties and members to enumerate the collection.
Note that usually this process is somehow automated in scripting and CLR languages. You will find the code samples in topics for the _NewEnum
and Item properties.
interface IDeviceCollection extends ${IDispatch} {
// Properties
readonly [${Item}: number]: ${IDevice};
${Count}: number;
${_NewEnum}: object;
}
public interface IDeviceCollection : ${IDispatch}
{
// Properties
${IDevice} ${Item}[int Index] { get; }
int ${Count} { get; set; }
object ${_NewEnum} { get; set; }
}
struct IDeviceCollection : IDispatch
{
// Properties
${IDevicePtr#IDevice} ${Item}(_variant_t Index); // get
long ${Count}; // get set
IUnknownPtr ${_NewEnum}; // get set
};
readonly [Item: number]: ${IDevice};
${IDevice} Item[int Index] { get; }
${IDevicePtr#IDevice} Item(_variant_t Index); // get
Reference to Device object.
Count: number;
int Count { get; set; }
long Count; // get set
Number of devices.
_NewEnum: object;
object _NewEnum { get; set; }
IUnknownPtr _NewEnum; // get set
Returns the enumerator object implementing IEnumVARIANT
interface.