Consultor Eletrônico



Kbase 21972: Did the Current Progress Session Start with an .ini File?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/16/2002
SUMMARY:

The following 4GL code determines whether the current 4GL client session was started with an .ini file or not.

EXPLANATION:

The way to answer this question is to get the command line with which the current session started, then parse its contents for the occurrence of the '.ini' string. This let's you know whether an .ini file was involved.

SOLUTION:

Although this code is designed to specifically answer the .ini question, it can be easily extended to expose all of the Progress session's startup parameters and extract their startup values as well.

/************************************/
DEFINE VARIABLE chrCommandLine AS CHARACTER NO-UNDO FORMAT "X(128)".
DEFINE VARIABLE ptrToString AS MEMPTR NO-UNDO.

PROCEDURE GetCommandLineA EXTERNAL "KERNEL32.DLL":
DEFINE RETURN PARAMETER ptrToString AS MEMPTR.
END PROCEDURE.

RUN GetCommandLineA (OUTPUT ptrToString).

ASSIGN chrCommandLine = GET-STRING(ptrToString,1).


IF INDEX(chrCommandLine, ".ini" ) <> 0 THEN
MESSAGE "Session started with an .ini file"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE
MESSAGE "Session started without an .ini file"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
/************************************/


References to Written Documentation:

Progress Knowledge Base Solution 17112, "How to Call WIN32 API Function: GetCommandLine"