Modifying the Update Utility

See Anatomy of the Update Utility for a detailed explanation of how the ProMatrix Update Utility works. Knowing how the Update Utility works will help you identify when you may need to modify it to handle special update situations that you encounter.

Chances are that you won’t need to modify the Update Utility, but when you do, select the Modify Update Utility option on the Update Builder menu. This option displays the Visual FoxPro Project Manager for the Update Utility. The Project Manger displays and lets you access the components of the Update Utility application.

The Update Utility project contains a main program (SAppUpd) and two class libraries (SAppUpd and SAppUpd2). These class libraries each contain a single class named ApplicationUpdate. The ApplicationUpdate class in the SAppUpd2 library is a subclass of the class in the SAppUpd library.

With this setup you can make your changes to the ApplicationUpdate class in the SAppUpd2 class library, which contains no VPME code, and avoid disturbing the VPME code that is in the ApplicationUpdate class in the SAppUpd class library.

Warning: If for some reason you determine that you need to modify the ApplicationUpdate class in the SAppUpd class library, be sure to make backup copies of the SAppUpd.vcx and SAppUpd.vct files found in the VPME home directory before you make your modifications. You can then restore this class to its original code from the backup you make.

The main program of the Update Utility application instantiates the application object from the ApplicationUpdate class in the SAppUpd2 library and runs its Do method, which performs the update of the application. After the Do method is run, the application object is released and the Update Utility application runs to completion.

The Update Utility can be run any number of times since the update does not modify in any way the files in the installation directory.

Tips for Modifying an ApplicationUpdate Method

If you decide to modify an existing ApplicationUpdate class method, be sure you understand the VPME code in that method. (You can, of course, view the VPME code by looking at that method in the ApplicationUpdate class of the SAppUpd class library.)

Then, determine how your modifications relate to the VPME code. Should your modifications come first or last? Use the DODEFAULT() function before or after your code to fire the VPME code before or after your code. If you want your code to block and replace the VPME method code, don’t use DODEFAULT()

Build and Rename EXE

After you make your modifications, choose the Build option on the Project menu to create a new Update Utility EXE. On the Build Options dialog, select “Build Executable”.

The name of the default Update Utility EXE file is SAppUpd.exe. We suggest that you give your modified Update Utility EXE a different name, such as S<prefix>upd.exe. A different EXE file name using the application prefix will help you identify the application to which a modified Update Utility EXE belongs.

More:

Copy Files