Consultor Eletrônico



Kbase P20891: How to return the command line of Windows Progress Session?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   06/05/2010
Status: Verified

GOAL:

How to get command line of Progress Session?

GOAL:

How to get the value of -ininame and -Basekey through 4GL?

GOAL:

How to know what the startup command of a 4GL session was ?

GOAL:

How to find the target of a 4GL session shortcut ?

FACT(s) (Environment):

Windows
Progress 8.x
Progress 9.x
OpenEdge Category: Language (4GL/ABL)

FIX:

Although you can specify a PF file (-pf param) in an .ini file (under the PROSTARTUP key in the STATUP section of an ini file), the -ininame (or -ini) and the -basekey parameters have to be used at the command line (they are ignored if used in a .PF file).

To get the values of the command line in a Progress Session, the following 4GL, for example, returns the -ininame and -basekey:


DEFINE VARIABLE chrCommandLine AS CHARACTER NO-UNDO.
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 LOOKUP("-basekey":U,chrCommandLine,"":U) > 0 THEN
MESSAGE 'value of "-basekey":':U
ENTRY(LOOKUP("-basekey":U,chrCommandLine,"":U) + 1,chrCommandLine,"":U)
VIEW-AS ALERT-BOX INFO BUTTONS OK.

IF LOOKUP("-ininame":U,chrCommandLine,"":U) > 0 THEN
MESSAGE 'value of "-ininame":':U
ENTRY(LOOKUP("-ininame":U,chrCommandLine,"":U) + 1,chrCommandLine,"":U)
VIEW-AS ALERT-BOX INFO BUTTONS OK. In OpenEdge 10.x a new session:startup-parameters attribute can be better used to get the command line.