GetNativePointer PowerScript function
Description
Gets a pointer to the OLE object associated with the OLE control.
The pointer lets you call OLE functions in an external DLL for the
object.
Controls
OLE controls and OLE custom controls
Syntax
|
1 |
<span>olename</span>.<span>GetNativePointer</span> ( <span>pointer</span> ) |
|
Argument |
Description |
|---|---|
|
olename |
The name of the OLE control containing |
|
pointer |
A UnsignedLong variable in which you |
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 GetNativePointer, PowerBuilder
calls OLE’s AddRef function, which locks
the pointer. You must release the pointer in your DLL function or in
a PowerBuilder script with the ReleaseNativePointer function.
Only for external DLL calls
This function is only useful for external DLL calls. It is
not related to the SetAutomationPointer function.
Examples
This example gets a pointer for the OLECustomControl ocx_spell for
making external function calls for OLE automation:
|
1 |
UnsignedLong lul_oleptr |
|
1 |
integer li_rtn |
|
1 |
|
1 |
li_rtn = ocx_spell.<span>GetNativePointer</span>(lul_oleptr) |
|
1 |
IF li_rtn = 0 THEN |
|
1 |
   ... // Call external functions for automation |
|
1 |
   ocx_spell.ReleaseNativePointer(lul_oleptr) |
|
1 |
END IF |