[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Forms' (#lcl)

TApplication.GetParams

Returns the command line argument at the specified ordinal position.

Declaration

Source position: forms.pp line 1592

protected function TApplication.GetParams(

  Index: Integer

):string; override;

Arguments

Index

  

Ordinal position for the requested parameter value.

Function result

String with the requested parameter value, or an empty string when not found.

Description

GetParams is an overridden String function in TApplication and is used to get the argument at the specified position in the command line. It re-implements the read access specifier for the Params property from the ancestor class (TCustomApplication), and does not call the inherited method.

Index is the ordinal position for the requested parameter value. Index should be in the range 0..ParamCount. Values in Index outside this range cause an empty string ('') to be returned for a parameter value.

In most cases, the parameter at position 0 contains the name and optional path to the executable file for the application. For cross-platform compatibility, use the ExeName property to get the path and name for the binary instead. Subsequent index positions contain any command line arguments passed to the executable.

The return value contains the UTF-8-encoded string with the value for the parameter at the specified position, or an empty string when not present. The value is retrieved using the ParamStrUTF8 routine for the position in Index.

See also

ParamStrUTF8

TCustomApplication.Params

TCustomApplication.ParamCount

ParamStr


Version 4.0 Generated 2025-05-03 Home