PowerBuilder Native Interface Programmers Guide and Reference

Appeon PowerBuilder® 2019

FOR WINDOWS

DOCUMENT ID: DC37794-01-1900-01

LAST REVISED: February 20, 2019

Copyright © 2019 Appeon. All rights reserved.

This publication pertains to Appeon software and to any subsequent release until otherwise indicated in new editions or technical notes. Information in this document is subject to change without notice. The software described herein is furnished under a license agreement, and it may be used or copied only in accordance with the terms of that agreement.

Upgrades are provided only at regularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Appeon Inc.

Appeon and other Appeon products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Appeon Inc.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP and SAP affiliate company.

Java and all Java-based marks are trademarks or registered trademarks of Oracle and/or its affiliates in the U.S. and other countries.

Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.

All other company and product names mentioned may be trademarks of the respective companies with which they are associated.

Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.

Appeon Inc., 1/F, Shell Industrial Building, 12 Lee Chung Street, Chai Wan District, Hong Kong


Table of Contents

Programmers Guide
Introduction to PBNI
About PBNI
Understanding PowerBuilder extensions
Embedding the PBVM in a C++ application
The elements of PBNI
The PBNI SDK
Comparing PBNI and JNI
Building PowerBuilder Extensions
Nonvisual extension example
Building the pbadd PowerBuilder extension
Using the extension in PowerBuilder
Creating a PowerBuilder extension
Step 1: Decide on a feature to implement
Step 2: Define the classes and functions in the extension
Step 3: Declare native classes and global functions
Step 4: Implement native classes and global functions
Step 5: Export methods to create class instances
Step 6: Build a PBX
Adding an extension to a PowerBuilder target
Using the extension
Creating and using a visual extension
Step 1: Decide on a feature to implement
Step 2: Define the classes and functions in the extension
Step 3: Declare visual classes and global functions
Step 4: Implement native classes
Step 5: Export methods to create class instances
Step 6: Build and use a PBX
Step 7: Use the visual extension in an application
Creating visual class instances
Event processing in visual extensions
Using an event name with return type and arguments
Using an event name with a PowerBuilder event ID
Processing events sent to the parent of the window
Calling PowerScript from an extension
Example: Calling PowerBuilder functions
Exception handling and debugging
Creating Marshaler Extensions
About marshaler extensions
Developing the PowerBuilder extension
Step 1: Describe the extension
Step 2: Implement the creator class
Step 3: Implement the marshaler class
Generating proxies for Java classes
Calling the Java class from PowerBuilder
Exchanging Data with PowerBuilder
About exchanging data with PowerBuilder
Passing values between extensions and the PBVM
PBCallInfo structure
IPB_Arguments interface
IPB_Value interface
Using the IPB_Session interface
Saving data from IPB_Value to a local variable
Using variables throughout a session
Handling enumerated types
Calling PowerBuilder from C++
About calling PowerScript from C++ applications
Calling PowerBuilder objects from C++
Creating a PowerBuilder object to be called from C++
Getting the signature of a function
Creating the C++ application
Running the C++ application
Accessing result sets
Processing PowerBuilder messages in C++
Examples
More PBNI possibilities
Reference
PBNI Types and Return Values
PowerBuilder to PBNI datatype mappings
Types for access to PowerBuilder data
PBNI enumerated types
Error return values
PBNI Interfaces, Structures, and Methods
Header file contents
Class and interface summary
IPB_Arguments interface
GetAt
GetCount
IPB_ResultSetAccessor interface
AddRef
GetColumnCount
GetColumnMetaData
GetItemData
GetRowCount
Release
IPB_RSItemData interface
SetData
SetNull
IPB_Session interface
AcquireArrayItemValue
AcquireValue
Add<type>Argument
AddGlobalRef
AddLocalRef
ClearException
CreateResultSet
FindClass
FindClassByClassID
FindGroup
FindMatchingFunction
FreeCallInfo
Get<type>ArrayItem
Get<type>Field
Get<type>GlobalVar
Get<type>SharedVar
GetArrayInfo
GetArrayItemType
GetArrayLength
GetBlob
GetBlobLength
GetClass
GetClassName
GetCurrGroup
GetDateString
GetDateTimeString
GetDecimalString
GetEnumItemName
GetEnumItemValue
GetException
GetFieldID
GetFieldName
GetFieldType
GetGlobalVarID
GetGlobalVarType
GetMarshaler
GetMethodID
GetMethodIDByEventID
GetNativeInterface
GetNumOfFields
GetPBAnyArrayItem
GetPBAnyField
GetPBAnyGlobalVar
GetPBAnySharedVar
GetProp
GetResultSetAccessor
GetSharedVarID
GetSharedVarType
GetString
GetStringLength
GetSuperClass
GetSystemClass
GetSystemGroup
GetTimeString
HasExceptionThrown
HasPBVisualObject
InitCallInfo
InvokeClassFunction
InvokeObjectFunction
IsArrayItemNull
IsAutoInstantiate
IsFieldArray
IsFieldNull
IsFieldObject
IsGlobalVarArray
IsGlobalVarNull
IsGlobalVarObject
IsNativeObject
IsSharedVarArray
IsSharedVarNull
IsSharedVarObject
NewBlob
NewBoundedObjectArray
NewBoundedSimpleArray
NewDate
NewDateTime
NewDecimal
NewObject
NewProxyObject
NewString
NewTime
NewUnboundedObjectArray
NewUnboundedSimpleArray
PopLocalFrame
ProcessPBMessage
PushLocalFrame
Release
ReleaseArrayInfo
ReleaseDateString
ReleaseDateTimeString
ReleaseDecimalString
ReleaseResultSetAccessor
ReleaseString
ReleaseTimeString
ReleaseValue
RemoveGlobalRef
RemoveLocalRef
RemoveProp
RestartRequested
Set<type>ArrayItem
Set<type>Field
Set<type>GlobalVar
Set<type>SharedVar
SetArrayItemToNull
SetArrayItemValue
SetBlob
SetDate
SetDateTime
SetDecimal
SetFieldToNull
SetGlobalVarToNull
SetMarshaler
SetProp
SetSharedVarToNull
SetString
SetTime
SetValue
SplitDate
SplitDateTime
SplitTime
ThrowException
TriggerEvent
UpdateField
IPB_Value interface
Get<type>
GetClass
GetType
IsArray
IsByRef
IsEnum
IsNull
IsObject
Set<type>
SetToNull
IPB_VM interface
CreateSession
RunApplication
IPBX_Marshaler interface
Destroy
GetModuleHandle
InvokeRemoteMethod
IPBX_NonVisualObject interface
IPBX_UserObject interface
Destroy
Invoke
IPBX_VisualObject interface
CreateControl
GetEventID
GetWindowClassName
PBArrayInfo structure
PBCallInfo structure
PB_DateData structure
PB_DateTimeData structure
PB_TimeData structure
PBX_DrawItemStruct structure
PBArrayAccessor template class
GetAt
IsNull
SetAt
SetToNull
PBBoundedArrayCreator template class
GetArray
SetAt
PBBoundedObjectArrayCreator class
GetArray
SetAt
PBObjectArrayAccessor class
GetAt
SetAt
PBUnboundedArrayCreator template class
GetArray
SetAt
PBUnboundedObjectArrayCreator class
GetArray
SetAt
Exported methods
PBX_CreateNonVisualObject
PBX_CreateVisualObject
PBX_DrawVisualObject
PBX_GetDescription
PBX_InvokeGlobalFunction
PBX_Notify
Method exported by PowerBuilder VM
PB_GetVM
PBNI Tool Reference
pbsig190
pbx2pbd190
Appendix
APPENDIX A Using the Visual Studio Wizards
Where the wizards are installed
Generating a PBNI project
Setting project options
Building and using the PBX