CreateStaticObject
- create static COM object

Miscellaneous functions
(AFL 1.8)


SYNTAX createstaticobject(
RETURNS OBJECT
FUNCTION Creates the single static instance (one per AmiBroker session) of "Server.Class" COM object. The return value should be assigned to a variable that is used latter for calling the methods of the object. This function is useful for "heavyweight" COM object like QuotesPlus ActiveX for example.
Note: this function creates the instance of the object only once when the formula is executed for the first time. Then the object is cached internally for all consecutive calls. It is also shared if multiple formulas use the same object using CreateStaticObject call. The object is automatically released when AmiBroker is closed.
EXAMPLE myobj = CreateStaticObject("MyOwnActiveX.Class1");
myobj.Method( 1, 2, Close ); // call the method of myobj COM object
SEE ALSO CreateObject() function

References:

The CreateStaticObject function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference