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.
Applies to
OLEObject
Syntax
|
1 |
oleobject.GetAutomationNativePointer ( pointer ) |
|
Argument |
Description |
|---|---|
|
oleobject |
The name of an OLEObject variable containing the object |
|
pointer |
An UnsignedLong variable in which you want to store the |
Return value
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 2 3 4 5 6 7 8 9 10 11 12 13 |
OLEObject oleobj_report UnsignedLong lul_oleptr integer li_rtn oleobj_report = CREATE OLEObject oleobj_report.ConnectToObject("report.doc") li_rtn = & oleobj_report.GetAutomationNativePointer(lul_oleptr) IF li_rtn = 0 THEN ... // Call external functions for automation oleobj_report.& ReleaseAutomationNativePointer(lul_oleptr) END IF |
See also