The OLEObject object acts as a proxy for a remote OLE object.
You can customize your own version of the OLEObject object by defining a standard class user object inherited from the built-in OLEObject. You can then access the OLEObject Constructor, Destructor, Error, and ExternalException events by writing scripts that contain code for the events.
Coding Error and ExternalException events
If you code the Error and ExternalException events, any active exception handler for a RuntimeError will not be processed. However, you can throw an exception in the scripts for these events, and you can make the arguments of these events available for exception handling by putting the arguments in a string in a throw statement that passes the string to the exception handler.
OLEObject objects are displayed in the OLE tab of the Browser as Programmable Objects.
For more information about creating a custom OLEObject object, see Working with User Objects in Users Guide.
For more information about using the OLEObject object in an application, see Using OLE in an Application in Application Techniques.
OLEObject is a dynamic object
In order to support OLE, OLEObject is a dynamic object. The PowerBuilder compiler accept property names and function names and parameter lists that are not already defined for the object. If the properties or functions do not exist during execution, you get a runtime error.
OLEObject property |
Datatype |
Description |
---|---|---|
ClassDefinition |
PowerObject |
An object of type PowerObject containing information about the class definition of the object or control. |
Handle |
Objhandle |
Internal use only. |
OLEObject event |
Occurs |
---|---|
Constructor in PowerScript Reference |
When the user object is created. |
Destructor in PowerScript Reference |
When the user object is destroyed. |
Error in PowerScript Reference |
When an error is found in a data or property expression for an external object. |
ExternalException in PowerScript Reference |
When the evaluation of an expression involving properties of an external object causes an error. This type of event occurs before the Error event. |
OLEObject function |
Datatype returned |
Description |
---|---|---|
ClassName in PowerScript Reference |
String |
Returns the name assigned to the user object |
ConnectToNewObject in PowerScript Reference |
Integer |
Creates a new instance of the class and connects to it |
ConnectToNewRemoteObject in PowerScript Reference |
Integer |
Creates a new OLE object in the specified remote server application and associates the new object with a PowerBuilder OLEObject variable |
ConnectToObject in PowerScript Reference |
Integer |
Opens a specified file and connects to the corresponding server application |
ConnectToRemoteObject in PowerScript Reference |
Integer |
Associates an OLE object with a PowerBuilder OLEObject variable and starts the server application |
DisconnectObject in PowerScript Reference |
Integer |
Releases all objects previously connected |
GetAutomationNativePointer in PowerScript Reference |
Integer |
Returns a pointer to the underlying OLE object |
GetContextService in PowerScript Reference |
Integer |
Creates a reference to a context-specific instance of the specified service |
GetParent in PowerScript Reference |
PowerObject |
Returns a reference to the name of the parent object |
IsAlive in PowerScript Reference |
Boolean |
Determines whether a server object is defunct |
PostEvent in PowerScript Reference |
Boolean |
Adds an event to the end of the message queue of the user object |
ReleaseAutomationNativePointer in PowerScript Reference |
Integer |
Releases the pointer to the underlying OLE object |
SetAutomationLocale in PowerScript Reference |
Integer |
Sets the language locale to be used for automation programming on the object |
SetAutomationPointer in PowerScript Reference |
Integer |
Sets the automation pointer of an OLEObject object to the value of the automation pointer of another object |
SetAutomationTimeout in PowerScript Reference |
Integer |
Sets the number of milliseconds that a PowerBuilder client waits before canceling an OLE procedure call to the server |
TriggerEvent in PowerScript Reference |
Integer |
Sends an event to the user object and executes the script associated with the event |
TypeOf in PowerScript Reference |
Object |
Returns the type of the user object |