GetNativePointer

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.

Applies to

OLE controls and OLE custom controls

Syntax

olename.GetNativePointer ( pointer )

Argument

Description

olename

The name of the OLE control containing the object for which you want the native pointer.

pointer

A UnsignedLong variable in which you want to store the pointer. If GetNativePointer cannot get a valid pointer, pointer is set to 0.

Returns

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.

NoteOnly for external DLL calls This function is only useful for external DLL calls. It is not related to the SetAutomationPointer function.

Examples

Example 1

This example gets a pointer for the OLECustomControl ocx_spell for making external function calls for OLE automation:

UnsignedLong lul_oleptr

integer li_rtn


li_rtn = ocx_spell.GetNativePointer(lul_oleptr)

IF li_rtn = 0 THEN

   ... // Call external functions for automation

   ocx_spell.ReleaseNativePointer(lul_oleptr)

END IF

See also