title: how to create Delphi hybrid (console or GUI) application depending on a parameter?
body: <p>Is it possible to create Create delphi application which is a GUI or Console application depending on a command or parameter(commands or parameter can be set while executing from command propt)</p>
  
  <p>I have tried as flows but its look like console application even if I pass the parameter or not</p>
  
  <pre><code>if (ParamStr(1) = 'test') then
    begin
      {$APPTYPE CONSOLE}
      WriteLn('Program ConsoleTest is running.');
      WriteLn('Press the ENTER key to stop');
      ReadLn;
    end
    else
    begin
      Application.Initialize;
      Application.MainFormOnTaskbar := True;
      Application.CreateForm(TfrmMain, frmMain);
      Application.Run;
    end;
  </code></pre>