GUI ScreenIO for Windows

 ScreenIO.com


GetCommandLine

This API returns the Command Line of the currently executing application.  This will include the full Path, executable name, as well as any command line arguments.

Your Compiler may provide similar APIs, which, while less transportable to other compilers may also be used

Client/Server issues

This command will execute only on the Server when used in a Client/Server application .  Execution on the client side would only show the command line of GSCLIENT, and would be of no use in your programming.  

Files

Files available to copy to your system:

Usage

     COPY WIN32API.
     COPY GETCMDLN.


     
* ------------------------: Call the API.
*
     SET API-GETCOMMANDLINE TO TRUE.

     CALL 'GSWINAPI' USING WIN32API-PARMS
                           API-COMMAND-LINE
                           WIN32API-B
                           WIN32API-C
                           WIN32API-D
                           WIN32API-E
                           WIN32API-F.

Parameters specific to this function

GCL-COMMAND-LINE

This is a 1024 byte area which will contain the command line of the currently executing program.  This can be very simple or very complex in the case of some compilers which start their own runtime environment, and pass the name of the desired program as a parameter.

Typically, this API is used where the programer needs to know the directory from which the EXE was launched, or the program needs to inspect it's own command line for arguments in some remote subroutine (not the main program) and it is inconvenient to pass theses command line arguments to each subroutine.

Be aware that command lines may include spaces, quotes etc, and may also include drive and directory paths in either Drive\Directory format "C:\Program files\directory\prog.exe" format or in UNC "Format " \\server\directory\prog.exe" format.  It may be in upper or lower case or mixed case.  Some versions of windows will allow forward slash "/" for directory indicators, (especially when a server is involved).

The best method is to to use our API-Lowercase to convert the entire string to lower case.

Then begin examining from the tail end (byte 1024), indexing backward looking for .exe.  This will give you the dividing line between the path to the executable and the command line arguments.  But be aware that the command line might be enclosed in quotes.

 

WIN32API-PARMS - Used in all GSWINAPI calls

This argument is standard for all CALLs to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.

WIN32API-RC

Used to return the status of a call to GSWINAPI.  A value of zero is a failure, any other value indicates success. 

Recommended usage is to test the 88-level value WIN32API to see if it worked, then to use the text error message to see why it failed.

* ------------------------: If function failed,
*                         :   display the error in a message box.
*
     IF WIN32API-FAILED
       MOVE WIN32API-ERROR-TEXT TO panel-MESSAGE-TEXT
       SET panel-MESSAGE-IN-MESSAGEBOX TO TRUE.

WIN32API-ERROR-CODE

Error code that was returned by Windows.  This is not generally useful unless you have the Windows Platform SDK documentation available to you.

WIN32API-ERROR-TEXT

Plain-text error message that describes why the operation failed.

WIN32API-A through WIN32API-F

The number of these present varies depending on how many arguments are used by the desired function.  These are not used, but must be present because this CALL requires seven arguments.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom