Kbase P4195: 4GL/ABL: How to call the WIN32 API function GetCommandLine
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  06/05/2010 |
|
Status: Verified
GOAL:
4GL/ABL: How to call the WIN32 API function GetCommandLine
GOAL:
How to get the command line that started the current client session
GOAL:
How to display the command line that started the current client session
GOAL:
How to get the command line used to open the current ABL session
GOAL:
How to get the startup-parameters and its values of the current ABL session
FACT(s) (Environment):
Windows
Progress 8.x
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)
FIX:
The following is a sample code shows how to call the WIN32 API function called GetCommandLine.
This code was tested using Progress 8, 9 and 10.
This function returns the command line used to start the current Progress client session. It returns the entire command line, not just the arguments passed to the prowin32.exe executable:
DEFINE VARIABLE chrCommandLine AS CHARACTER NO-UNDO FORMAT "X(128)".
DEFINE VARIABLE ptrToString AS MEMPTR NO-UNDO.
RUN GetCommandLineA (OUTPUT ptrToString).
ASSIGN chrCommandLine = GET-STRING(ptrToString,1).
MESSAGE chrCommandLine
VIEW-AS ALERT-BOX INFO BUTTONS OK.
PROCEDURE GetCommandLineA EXTERNAL "KERNEL32.DLL":
DEFINE RETURN PARAMETER ptrToString AS MEMPTR.
END PROCEDURE.
Starting in OpenEdge 10.x a new SESSION attribute STARTUP-PARAMETERS is also available.
It returns a character string containing a comma-separated list of all startup parameters you defined at startup for the current ABL session.
This list includes startup parameters defined in the ABL default startup parameter file ($DLC/startup.pf) or the file specified by the $PROSTARTUP environment variable, as well as startup parameters you specify on the command line or within a parameter file (.pf). The value of this attribute does not change during run time.
The following is a sample code on how to use this attribute.
MESSAGE SESSION:STARTUP-PARAMETERS
VIEW-AS ALERT-BOX INFO BUTTONS OK.