Description:Instantiates an ActiveX object. An ActiveX object is treated as a COM client interface that requires a client window area in which to draw.
Usage: Steady State only.
Warning:This function should be used only by advanced programmers. It may interfere with VTScada graphics.
Function Groups:COM
Related to:COMClient | COMEvent | COMStatus
Format: ActiveX(X0, Y0, X1, Y1, ObjectIdentifier, EventSearchScope[, EventParent, EventCaller, LicenseString])
X0, Y0, X1, Y1
Required These are the numeric coordinates of the client window area in which the COM object is to draw itself.
Required. Specifies a unique identifier for the object that is to be instantiated. It may take one of the following forms:
• A text string representing a ProgID (e.g. "Excel.Application").
• A textual GUID in registry format (e.g. "{000208-0000-0000-C000-000000000046}"). Note that the curly braces are compulsory.
• A binary GUID (e.g. the result from "GetGUID(1, 00020812-0000-0000-C000-000000000046)").
Required. May be any expression that yields a module value or object value. This parameter specifies the scope in which to search for event subroutines. If missing or invalid, the COM events will not be enabled.
Optional Any expression yielding an object value. If present, specifies the context that is used to resolve scope for event subroutines. May be any expression that yields an object value.
Defaults to Self().
Optional. Any expression that yields an object value. If present, this specifies an "auxiliary" context for event subroutines. An event subroutine can retrieve this value using Caller(Self())
Defaults to Self().
Optional. Used to provide a license key that will be passed to the ActiveX control when instantiated, permitting the use of ActiveX controls that require license data for activation. This will work for both server-instantiated ActiveX controls and those that are remotely called by a VIC.

If the statement succeeds, a COM client interface is returned, allowing subsequent access to the object. If it fails, Invalid is returned.
There are two significant parametric differences between an ActiveX function and a COMClient function. Firstly, the ActiveX function requires a client window in which to draw. Secondly, there is no ObjectContext parameter. ActiveX objects are only instantiated in process, as they require direct GDI access to process resources [such as the client window area].
A window in VTScada acts as a container for ActiveX objects, in the true OLE definitions of the OC96 specification. This architecture provides a container enumerator so that an ActiveX object can interact with other ActiveX objects in the same container.
Like the COMClient function, this function returns an opaque COM Client Interface handle, through which subsequent object manipulations are performed.
Unlike the COMClient function, this statement may be only be used as a steady-state statement.
The ActiveX object will only remain instantiated while the steady-state statement is still running (i.e. a change of state or destruction of the module instance which is running the statement will cause the ActiveX object to be destroyed). Any variables that hold a handle to the COM Client Interface will be invalidated at that time.

Within an Anywhere Client session, this function does nothing.


Loaded = 0;
BrowserObj = ActiveX(12, 52, w - 22, h - 42, "Shell.Explorer");
If Timeout(Valid(BrowserObj) && !Loaded, 1);
Loaded = 1;

Example 2:

MyObject = ActiveX(… );
X = MyObject\DoSomething(aValue); { A method call on the object }
MyAxObjects\AProperty = "Hello"; { A property set }
Y = MyAxObject\AnotherProperty; { A property get }

Trihedral and VTScada are registered trade marks of Trihedral Engineering Ltd.
© Trihedral Engineering Ltd. 1983- 2019 All rights reserved.