SetAutomationTimeout PowerScript function
Description
Sets the number of milliseconds that a PowerBuilder client
waits before canceling an OLE procedure call to the server.
Controls
OLEObject objects
Syntax
1 |
<span>oleobject</span>.<span>SetAutomationTimeout</span> ( <span>interval</span> ) |
Argument |
Description |
---|---|
oleobject |
The name of an OLEObject variable containing |
interval |
A 32-bit signed long integer value (in |
Return Values
Integer. Returns 0 if it succeeds and
-1 if it fails.
Usage
This function passes the value of interval to
PowerBuilder’s implementation of the IMessageFilter interface
and determines how long PowerBuilder tries to complete an OLE procedure
call. The value applies only when PowerBuilder is the OLE client,
not when PowerBuilder is the OLE server.
For most situations, you do not need to call SetAutomationTimeout.
The default timeout period of five minutes is usually appropriate.
Use SetAutomationTimeout to change the default
timeout period if you expect a specific OLE request to take longer
than five minutes.
If the timeout period is too short, you may get a PowerBuilder
application execution error, R0035. In this case, use SetAutomationTimeout to
lengthen the timeout period.
If the timeout period expires, runtime error 1037 occurs.
You may want to add code to handle this error, which is often the
only indication of a hung server. Note that canceling a transaction
often causes memory leaks on both the server and the operating system.
The value that you specify with SetAutomationTimeout applies
to all OLE transactions in the current session, including calls
that relate to other objects.
Examples
This example calls the ConnectToObject function
to connect to an Excel worksheet and sets a timeout period of 900,000
milliseconds (15 minutes):
1 |
OLEObject ole1 |
1 |
integer rs |
1 |
long interval |
1 |
1 |
interval = 900000 |
1 |
ole1 = create OLEObject |
1 |
rs = ole1.ConnectToObject("Excel.Application") |
1 |
rs = ole1.<span>SetAutomationTimeOut</span>(interval) |