AcquireArrayItemValue – PB Docs 125
IPB_Session interface: AcquireArrayItemValue method Description Clones the data in the PBCallInfo structure in an array item and resets the IPB_Value pointer. Syntax
|
1 |
AcquireArrayItemValue( pbarray <span>array</span>, pblong <span>dim</span>[ ]<span></span>) |
Argument Description array A valid pbarray structure. dim A pblong array to hold the indexes of all dimensions of the array. The size of the array must equal the dimensions of array….
IPB_Session interface – PB Docs 125
IPB_Session interface Description The IPB_Session interface is used to interoperate with PowerBuilder. An abstract interface, it defines methods for accessing PowerScript data, calling PowerScript functions, catching and throwing PowerScript exceptions, and setting a marshaler to convert PowerBuilder data formats to the user’s communication protocol. Methods This table lists functions by category. Full descriptions in alphabetic…
PBNI Interfaces, Structures, and Methods – PB Docs 125
PBNI Interfaces, Structures, and Methods About this chapter This chapter contains reference information about the classes, structures, and methods of the PowerBuilder Native Interface. Contents Topic Header file contents Class and interface summary IPB_Arguments interface IPB_ResultSetAccessor interface IPB_RSItemData interface IPB_Session interface IPB_Value interface IPB_VM interface IPBX_Marshaler interface IPBX_NonVisualObject interface IPBX_UserObject interface IPBX_VisualObject interface PBArrayInfo structure…
Class and interface summary – PB Docs 125
Class and interface summary This table lists the classes and interfaces that make up PBNI. After the table, the classes and interfaces are listed in alphabetical order. The methods for each class are listed in alphabetical order after the class description. Several additional helper classes that are defined in pbni.h are not listed in the…
Write cleanup code – PB Docs 125
Write cleanup code When you have finished with the PBCallInfo structure, call FreeCallInfo to release the memory allocated to it, then delete the structure, release the session, and free the library:
|
1 |
   // Release Call Info<br>   session->FreeCallInfo(&ci);<br>   delete &ci;<br> <br>   // Release session<br>   session->Release();<br>   return 0;<br>   FreeLibrary(hinst);<br>} |
Document get from Powerbuilder help Thank you for watching.
Call the PowerBuilder function – PB Docs 125
Call the PowerBuilder function Before you call the function, you must supply the integers to be multiplied. For the sake of simplicity, the following code sets them directly in the PBCallInfo structure.
|
1 |
   // Set IN arguments. The prototype of the function is<br>   // integer f_mult(integer arg1, integer arg2)<br>   ci.pArgs-> GetAt(0)->SetInt(123);<br>   ci.pArgs-> GetAt(1)->SetInt(45); |
Finally call the function, wrapping it in a try-catch statement to handle any runtime errors:
|
1 2 |
   // Call the function<br>   try<br>   {<br>      session->InvokeObjectFunction(pbobj, mid, &ci);<br> <br>      // Was PB exception thrown?<br>      if (session->HasExceptionThrown())<br>      {<br>         // Handle PB exception<br>         session->ClearException();<br>      }<br>   }<br>   catch (...)<br>   {<br>      // Handle C++ exception<br>   }<br> <br>   // Get the return value and print it to the console<br>   pbint ret = ci.returnValue->GetInt();<br>   fprintf(stderr, "The product of 123 and 45 is %i ",<br>      ret); |
Document get from Powerbuilder help Thank…
Processing PowerBuilder messages in C++ – PB Docs 125
Processing PowerBuilder messages in C++ You can open a PowerBuilder window from a C++ application or from an extension, but to make sure that events triggered in the window or control are processed, you need to make sure that the C++ application processes PowerBuilder messages. The IPB_Session ProcessPBMessage function lets you do this. Each time…
Accessing result sets – PB Docs 125
Accessing result sets You can use the IPB_ResultSetAccessor interface to access result sets in PowerBuilder. Use the IPB_Session GetResultSetAccessor method to create an instance of the interface using a result set returned from PowerBuilder as the method’s argument. You can then use the IPB_ResultSetAccessor’s getColumnCount, GetRowCount, GetItemData, and GetColumnMetaData methods to obtain information from the…
Running the C++ application – PB Docs 125
Running the C++ application When you run the compiled executable file at the command prompt, if the PowerBuilder VM is loaded and the session is created successfully, the following output displays in the command window:
|
1 |
Loaded PBVM successfully<br>Created session successfully<br>The product of 123 and 45 is 5535 |
Document get from Powerbuilder help Thank you for watching.
The elements of PBNI – PB Docs 125
The elements of PBNI To enable the features described in the previous section, PBNI provides interfaces, structures, global functions, and helper classes. These elements are described in more detail in the reference section of this guide. See Chapter 7, “PBNI Interfaces, Structures, and Methods.” This section provides an overview. Interfaces The IPB_VM interface is used…