Serial Port Monitoring Control - ActiveX Component Library for RS232 Data Monitoring, API for Software Developers
Download Serial Port Monitoring Control Hide this button

IDeviceCollection Interface

This interface is used to enumerate existing serial devices. It is implemented by the Serial Monitoring Control.

You obtain this interface by taking the value of the ISerialMonitor.Devices property and use it to enumerate the installed serial 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 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 methods to enumerate the collection.

Note that usually this process is somehow automated in scripting and CLR languages.

Declaration

// This interface is not available in scripting environment
public interface IDeviceCollection
{
    // Properties
    ${IDevice} ${this}[object Index] { get; set; }
    int ${Count} { get; }

    // Methods
    IEnumerator ${GetEnumerator}();
}
struct IDeviceCollection : IDispatch
{
    // Properties
    ${IDevicePtr#IDevice} ${Item}(const _variant_t & Index);  // get set 
    long ${Count};  // get 

    // Methods
    IUnknownPtr ${Get_NewEnum#GetEnumerator}();
};

IDeviceCollection Properties

this

// This property is not available in scripting environment
${IDevice} this[object Index] { get; set; }
${IDevicePtr#IDevice} Item(const _variant_t & Index);  // get set 

Returns the device from the collection.

Count

// This property is not available in scripting environment
int Count { get; }
long Count;  // get 

Returns the total number of devices in a collection object.

IDeviceCollection Methods

GetEnumerator

// This method is not available in scripting environment
IEnumerator GetEnumerator();
IUnknownPtr Get_NewEnum();

Returns standard OLE enumerator for this object.