1. Ian Ho
  2. PowerBuilder
  3. Tuesday, 9 June 2020 09:21 AM UTC

Currently deploying a Windows application with an EXE together with some PBD files.

 

If I managed to update the PBD when the users is running the application, is there a way to force the application to reload the updated PBD without restarting the application? Thanks.

 

What I tried:

Updated client PBD files

The window / datawindow / functions of the updated PBD remains unchanged until closing and restarting the application.

Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 9 June 2020 16:49 PM UTC
  2. PowerBuilder
  3. # 1

Here is how I've done it in the past.

Program files are stored on a network drive that is available to everyone. In our case it was the K drive with the following folders:

K:\PBApps\Appname

K:\PBApps\Appname\version1

K:\PBApps\Appname\version2

 

The two version folders have copies of the exe & pbd files.

The Appname folder has a .bat file that launches the application from one of the version folders, the one that is current. The shortcut on end users desktop points to the .bat file.

So if version1 is current, I would copy the new exe into version2 and then modify the .bat file to point to version2. Then I would send an email to all users letting them know that they need to logout and back in to pick up a new version.

At a previous employer we used a program which was a windowless app that read a .ini file to determine which version folder to launch the app from. The advantage to that approach was that it had the same program icon making shortcut creation easier.

 

Comment
  1. Ian Ho
  2. Wednesday, 10 June 2020 00:48 AM UTC
I am currently storing the version number and the pbd binaries on the database table. Coded the program to check for version changes and automatically overwrite PBDs using FileWriteEx(). It works for PBD update (not EXE). However, if users are currently opening the application (even multiple instances), changes are not reflected in "real time" without a restart.



I hope I can find a way to make update process smooth without interrupting program usage with a restart.
  1. Helpful
  1. Roland Smith
  2. Wednesday, 10 June 2020 02:36 AM UTC
There are two issues that prevent you from doing what you want:

The EXE file is locked by the operating system when someone is running it.

When an object is instantiated for the first time, the PBD is loaded into memory so the file is never accessed again.
  1. Helpful
  1. Ian Ho
  2. Wednesday, 10 June 2020 03:55 AM UTC
Right, EXE cannot be updated using FileWriteEx().

Maybe I popup a messagebox() after update and suggest users to restart their applications then. Thanks
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 9 June 2020 15:38 PM UTC
  2. PowerBuilder
  3. # 2

Hi Ian;

  FYI: Once an object is referenced from a PBD, it's "definition" is cached in the "Class Pool" memory buffer of the PBVM. If your App references that same object class again, the PB Loader checks the Class Pool first and will always take the definition from there before searching a PBD.

Regards ... Chris

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 9 June 2020 13:52 PM UTC
  2. PowerBuilder
  3. # 3

you need to restart the application.

I believe the pbd itself isn't loaded, but the objects that are used are loaded into memory.  

 

What we do is check for updates, copy them to the local machine, then restart the application using the user's login information via commandline

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.