HasParamStr function
String / Filename routines
Return to Introduction  Previous page  Next page
Unit
acUtils  

Declaration
function HasParamStr(const Param: String): Boolean;  

Description
The HasParamStr function used to check whether the application was executed with some command-line argument (Param parameter). It returns True if the parameter found within command line arguments, or False otherwise.  

Example
// code from Loaded method of acTrayIcon component.  
if HasParamStr('/minimized'then  
  StartMinimized := True;  

Original Code
function HasParamStr(const Param: String): Boolean;  
var  
  I: Integer;  
begin  
  if ParamCount <> 0 then  
   for I := 1 to ParamCount do  
    if AnsiLowerCase(ParamStr(I)) = AnsiLowerCase(Param) then  
     begin  
      Result := True;  
      Exit;  
     end;  
  Result := False;     
end;