Consultor Eletrônico



Kbase P17094: 4GL method to check registry for installed Progress products
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/21/2003
Status: Unverified

GOAL:

4GL method to check registry for installed Progress products and version

FIX:

The following code reads from the registry the Progress keys for the products which were installed.  It is then possible to check the returned values for products and then retrieve which versions the products have installed.  The example below looks for Progress registry keys beginning with 'Prov' to return provision products installed (if any) and then checks for the versions of the Provision products.  This can be easily modified to check for a number of products / versions or other registry values.


DEFINE VARIABLE cProducts  AS CHARACTER  NO-UNDO.
DEFINE VARIABLE cProvision AS CHARACTER  NO-UNDO.
DEFINE VARIABLE cVersions  AS CHARACTER  NO-UNDO.
DEFINE VARIABLE cSection   AS CHARACTER  NO-UNDO.
DEFINE VARIABLE i          AS INTEGER    NO-UNDO.
DEFINE VARIABLE lp         AS INTEGER    NO-UNDO.

LOAD "SOFTWARE\PSC" BASE-KEY "HKEY_LOCAL_MACHINE".
     USE  "SOFTWARE\PSC".
     GET-KEY-VALUE SECTION ""
                   KEY     ""
                   VALUE   cProducts.

     UNLOAD "SOFTWARE\PSC".

lp = NUM-ENTRIES(cProducts).
REPEAT i=1 TO lp:
   IF ENTRY(i, cProducts) BEGINS "Prov" THEN DO:
       IF cProvision = "" THEN
           cProvision = ENTRY(i, cProducts).
       ELSE cProvision = cProvision + "," + ENTRY(i, cProducts).
   END. /* IF ENTRY(i, cProducts) BEGINS "Prov" */

END. /* REPEAT i=1 TO lp */

MESSAGE cProducts SKIP
       VIEW-AS ALERT-BOX INFO BUTTONS OK
        TITLE STRING(lp) + " Products installed".

lp = NUM-ENTRIES(cProvision).
REPEAT i=1 TO lp:
  cSection = ENTRY(i, cProvision).
  LOAD "SOFTWARE\PSC\" + cSection BASE-KEY "HKEY_LOCAL_MACHINE".
     USE  "SOFTWARE\PSC\"  + cSection.
     GET-KEY-VALUE SECTION ""
                   KEY     ""
                   VALUE   cProducts.

  MESSAGE "Product:" cSection SKIP "Version(s):" cProducts
          VIEW-AS ALERT-BOX INFO BUTTONS OK
           TITLE "Provision Product and version(s)".

END. /* REPEAT i=1 TO lp */

UNLOAD "SOFTWARE\PSC\" + cSection.