COM Objects in DSF

DSF uses COM automation objects to expose DSF services to device simulators. You can access these objects from any COM client-capable language. Almost all objects expose dual interfaces that use only OLE automation-compatible data types.

COM methods and properties that return objects always return them as pointers to the object's co-class type as defined in the MIDL-generated header file. C++ clients must cast the returned pointer to the object's default dual interface type. This cast helps maintain compatibility with scripting languages that do not differentiate between multiple interfaces on an object and enable access to the object only through its default dual interface.

In addition to individual objects, DSF also defines many collections of objects. These collections are all standard OLE automation collections that support Add, Remove, and Clear methods and Item and Count properties.

All collections support the _NewEnum property for enumeration (for example, by using the VBScript For/Each syntax). _NewEnum returns an IUnknown on an enumerator object that supports the IEnumVARIANT interface. The IEnumVARIANT::Next method returns VARIANT values with the VT_DISPATCH type that contain an IDispatch on the collection item.

Collection indexes are VARIANT values that might contain either an integer or an arbitrary string. The Add method takes an optional index argument that, when not specified, receives a default value that uses a zero-based ordinal (that is, the value of the collection's Count property before the Add method was called). In addition to the standard methods and properties, collections also support Lock and Unlock methods that can temporarily prevent changes to the collection from other threads. Callers can use only the Count and Item properties while the collection is locked.

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010