1. Roland Smith
  2. PowerBuilder
  3. Wednesday, 10 March 2021 00:26 AM UTC

PowerBuilder has an unknown number of runtime options that are set by deploying pb.ini with the exe. I say unknown because none of them are in the help file, all public knowledge is in the user forums.

Forum comments I have seen say to put pb.ini in the same folder as the .exe. Myself and others are having a problem with that. If for some reason the pb.ini file cannot be placed in the .exe folder, where can it be placed instead?

I'm guessing that the runtime is using GetPrivateProfileString to get the values. The description of the filename argument is:

The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.

The question therefore is: Where can the pb.ini file be? There is no way to know if it failed to find it. If I put it in the folder with the runtime and it is in the search path, will it be found?

 

Using a pb.ini for runtime options is a poor design choice. Several months ago I submitted an enhancement request that would add a set runtime option function. It would have two arguments, the option name and the option value. All possible pb.ini options should be changed to use this new function and be well documented in the help. Even better, make the option name argument an enumerated value.

Example:

SetRuntimeOption(DataStoreUseHwnd!, True)

 

Simone Olianti Accepted Answer Pending Moderation
  1. Thursday, 11 March 2021 14:37 PM UTC
  2. PowerBuilder
  3. # 1

i would like to know more about this aswell

taking advantage of this question, as stated in another thread, i'm having trouble enabling this command in the pb.ini on my application:

[DataStore Behavior]
UseHwnd=no

if i enable this on my pb.ini and starting my app from a compiled .EXE i'm getting trouble accessing a remote datastore accessed via restclient. If i run it from the IDE with the same command enabled it's working fine.
In particular this is the code i'm using which fails:

RESTClient inv_RestClient
inv_RestClient = CREATE RESTClient
inv_RESTClient.SetRequestHeader ("Content-Type", "application/json;charset=UTF-8")
inv_RestClient.Setrequestheader( "Accept-Encoding", "gzip")

datastore dss
dss = create datastore
dss.dataobject='dss_startreg_new_find'
ls_Request_Url = ls_url+"startregnewfind/Retrieve?codaz=" + ls_codaz
inv_RestClient.retrieve(dss, ls_Request_Url)
if dss.rowcount( ) > 0 then
    messagebox("SUCCESS!", "")
else
    messagebox("FAILED!", "")
end if
destroy dss
destroy inv_RestClient

if i put the pb.ini in the client folder where is the app .exe the retrieve always failing. If i remove it, it's working fine.
This is a pity cos i've notice a general improvement of my application with that command enabled.




Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 10 March 2021 16:33 PM UTC
  2. PowerBuilder
  3. # 2

Hi Everyone;

  Just an FYI ...

1) The STD Framework uses direct calls to PBVM and PBSHR DLLs.  Have a look in the framework for these references and how they are being used. The framework has tons of in-line documentation on how & why these calls are being used.

2) The Framework has a sub-folder called INI. In there, you will find a PB.INI with most of the options that I know about and appropriate comments around each.

3) The STD Framework's OrderEntry Demo App uses quite a few of the above. So a good place to to review actual working code.

4) The "nc_app_Controller_master" NVUO in the "STD_FC_PB_Base" PBL has almost all the MS-Window's API functions defined in it that most any PB App would possibly use.

Framework: http://sourceforge.net/projects/stdfndclass/files/FrameWork/Integrated

Demo App: http://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry

PS: I will be uploading a newer Beta version of the framework's OrderEntry App for PB2019R3 and PB2021 later today to SourceForge. A new "beta" version of the OE App was uploaded for PB2019R2 last night. This R2 beta is all about aligning the code for R3 and PB2021.  ;-)

HTH

Regards ... Chris

Comment
  1. Olan Knight
  2. Thursday, 11 March 2021 00:26 AM UTC
Awesome! Thank you, Chris!
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 11 March 2021 17:27 PM UTC
Welcome Olan!

FYI: New STD Framework OE Demo App "Beta release" for PB2019R3 loaded last night.

http://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry/Beta/PB2019R3

Refactoring for PB2019R3 almost complete.
  1. Helpful
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 10 March 2021 08:30 AM UTC
  2. PowerBuilder
  3. # 3

Hi Roland,

 

If there’s PB IDE installed on the machine, then pb.ini resides in the path of %localappdata%\Appeon\PowerBuilder 19.0.

 

If PB IDE is not installed on the machine, then pb.ini has to be put in the same folder as the .exe to take effect. It will not take effect if pb.ini is put in the runtime path or the search path or other paths.

 

Regarding the enhancement request of “add a set runtime option function” to take place of some settings in pb.ini, I think this is a very decent suggestion. I will submit this again as a new requirement to the Product Team. They will prioritize the implementation of requirements.

 

Regards,

Ken

 

Comment
  1. Miguel Leeuwe
  2. Wednesday, 10 March 2021 10:10 AM UTC
Please don't forget to ask for official documentation about the possible options too, as asked for by Roland.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 10 March 2021 06:39 AM UTC
  2. PowerBuilder
  3. # 4

Hi Roland,

I agree with you.

 

I used ProcMon to find out where the application is seaching for PB.INI:

First place is the application EXE directory.

If it doesn't find the file it seems it uses the PB.INI from C:\Users\[currentuser]\AppData\Local\Appeon\PowerBuilder 19.0. (Seems it takes this path from registry.)

I renamed the file to check if it is seaching at other places. But it seems not.

 

I think it would not be a good idea to look for pb.ini in system path. If an application would place its pb.ini anywhere it would be no guarantee that it would be found first. Maybe another applications places another pb.ini. First found - first servers may produce problems.

Of course, using a function to set an option would be the best way!

Regards,

René

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 10 March 2021 00:45 AM UTC
  2. PowerBuilder
  3. # 5

Like you, I would LOVE to see a list of ALL of the runtime options, whether they're put in the INI file or set with a function.

Olan

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.