Salesforce

Runtime Behavior - Invoke COM (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

Runtime Behavior – Invoke COM

When a task with defined OLE variables is opened, Magic xpa automatically instantiates the defined objects.

Any Invoke COM operation is executed for the instantiated object.

When the task that instantiated the object is closed, the object is automatically released.

For more information, see the following:

Passing Objects as Arguments

You can pass an object as an argument to another task, usually to have the other task continue and manipulate the created object.

For this purpose, you need to create a variable in the called task that will enable you in development time to handle the object using the Invoke COM operation and the event handler. This variable should be a parameter, so the calling task can pass its already instantiated object.

Most importantly, you should set the Instantiation property of the variable to None. Setting the Instantiation property to None means that the variable does not instantiate a COM object and can be set with a reference to an already existing object, such as an object passed as an argument.

Manual Object Instantiation

The default setting of an OLE variable is set to be instantiated automatically by the Magic xpa engine when opening the task in which the COM object variable is defined. The object is released when the task is closed.

If you wish to manually instantiate and release an object, you can do so by setting the Instantiation property of the field definition to None, and create and release the object by using the COMObjCreate and COMObjRelease functions.

Note:

If the Instantiation property is disabled, you cannot create the object manually.

Referring to a Created Object

Every COM object is identified by an internal number, also known as a handle.

You may manually instantiate an object in one task, keep its handle, and have another task refer to the created object by using its handle.

This is done by using the COMHandleGet and COMHandleSet functions.

Retrieving COM Errors

Use the COMError function to retrieve information regarding the last COM-related error.

Reference
Attachment 
Attachment