GetAutomationNativePointer PowerScript function
Description
Gets a pointer to the OLE object associated with the OLEObject
variable. The pointer lets you call OLE functions in an external
DLL for the object.
Controls
OLEObject
Syntax
|
1 |
<span>oleobject</span>.<span>GetAutomationNativePointer</span> ( <span>pointer</span> ) |
|
Argument |
Description |
|---|---|
|
oleobject |
The name of an OLEObject variable containing |
|
pointer |
An UnsignedLong variable |
Return Values
Integer. Returns 0 if it succeeds and
-1 if an error occurs.
Usage
Pointer is a pointer to OLE’s
IUnknown interface. You can use it with the OLE QueryInterface function
to get other interface pointers. When you call GetAutomationNativePointer,
PowerBuilder calls OLE’s AddRef function, which
locks the pointer. You can release the pointer in your DLL function
or in a PowerBuilder script with the ReleaseAutomationNativePointer function.
This function is useful only for external DLL calls. It is
not related to the SetAutomationPointer function.
Examples
This example creates an OLEObject object, connects
to an automation server, and gets a pointer for making external
function calls. After processing, the pointer is released:
|
1 |
OLEObject oleobj_report |
|
1 |
UnsignedLong lul_oleptr |
|
1 |
integer li_rtn |
|
1 |
|
1 |
oleobj_report = CREATE OLEObject |
|
1 |
oleobj_report.ConnectToObject("report.doc") |
|
1 |
li_rtn = & |
|
1 |
oleobj_report.<span>GetAutomationNativePointer</span>(lul_oleptr) |
|
1 |
IF li_rtn = 0 THEN |
|
1 |
... // Call external functions for automation |
|
1 |
oleobj_report.& |
|
1 |
ReleaseAutomationNativePointer(lul_oleptr) |
|
1 |
END IF |