the current Progress executable

by Sturla Johnsen

This procedure is convenient for tech support: it shows some information about the currently running Progress process like path and name of the Progress executable ("D:\DLC\BIN\PROWIN32.EXE"), the Progress version ("8.2C") and the serial number (believe me).

DEFINE VARIABLE hModule   AS INTEGER   NO-UNDO.
DEFINE VARIABLE cFileName AS CHARACTER NO-UNDO.
DEFINE VARIABLE RetVal    AS INTEGER   NO-UNDO.
 
ASSIGN hModule   = ?
       cFileName = FILL(" ",256).
 
RUN GetModuleFileNameA(hModule, OUTPUT cFileName, 256, OUTPUT RetVal).
 
MESSAGE "Progress exe :" SUBSTRING(cFileName, 1, RetVal) SKIP
        "version:"       PROVERSION SKIP
        "Serial number:" _SERIAL 
   VIEW-AS ALERT-BOX.     

Definitions used in this procedure, not listed in windows.p :

PROCEDURE GetModuleFileNameA EXTERNAL "kernel32.dll" :
  DEFINE INPUT  PARAMETER hModule    AS LONG.
  DEFINE OUTPUT PARAMETER lpFilename AS CHARACTER.
  DEFINE INPUT  PARAMETER nSize      AS LONG.
  DEFINE RETURN PARAMETER ReturnSize AS LONG.
END PROCEDURE.

Notes:

It is not required to find the actual module handle, because GetModuleFileName with module=NULL (or =? as we say in Progress) is documented to return the name of the module that started the process.
This makes it a light and convenient alternative for the source in example Modules in the current process which enumerates the names of all the modules in the current process.
An other advantage of this example is that function GetModuleFileName is available in every Windows version.