COM object references

 

COM is an abbreviation for Microsoft Component Object Model.

 

COM object references are often needed,

-   to access TCE server objects and their events

-   to access TCE client objects and their events

-   to access external objects and their events, bound by their Type library

-   to access objects and their events of external applications, whose provide a COM Type library

 

A COM object reference will be constructed by the name of the Type library and a class name:

 

Example:

Example for accessing the server object of TCE server, to be able to receive its events

 

The COM reference shown in the image above will be build by the Typelib name TCEServer and the class name Server. Because of the initialization with the global Server object of TCE the COM reference will receive events, if the setting Use events is switched on.

 

COM references can be built for local variables too:

 

Function Load(ByVal xml As String) As Void

   Dim DOM As New MSXML2.DOMDocument

  

   On Error Resume Next

  

   If xml <> "" Then

      DOM.loadXML(xml)

   Else

      DOM.loadXML(constDefaultXML)

   End If

  

   DefaultCalendar := DOM.selectSingleNode("UserSettings/DefaultCalendar").nodeTypedValue

   DefaultTask := DOM.selectSingleNode("UserSettings/DefaultTask").nodeTypedValue

End Function

 

In this case the COM object reference will be build by the Type library MSXML2 and the class name DOMDocument. Because the class is marked with the ability to create new objects, a new object for the variable DOM can be created by the New operator:

 

Dim DOM As New MSXML2.DOMDocument

 

Before COM Type libraries can be used with TCE, they have to be registered in the knowledge base properties. Here there are three switches available:

-   Typelib: Registration for server programming purposes

-   Control: Registration for clientside controls

-   Client: Registration for clientside COM objects

 

Example for a complex registration of Type libraries

 

TCE only supports COM objects, whose provide the IDispatch interface.

 

COM object references also have standard attributes, whose can be accessed by the ! operator.

 

DOM!MarkChanged()

 

 

Attributes, attribute functions and events:

 

Standard attributes:

 

AssignRuleIndex

Changed

Description

IsEnabled

IsVisible

ItemList

Name

Tag

UserTouched

Valid

ValueTag

ValueTagItems

 

 

More:

Further examples for COM object references

ApplicationPath (COM object references)

ObjPtr (COM object references)

MarkChanged (COM object references)

TypeName (COM object references)