Delphi app Command Line


[ Delphi Forum ]

Posted by Joey on February 08, 2004 at 18:08:07:

Heya. I am using the following code to allow command lines to be run into my Delphi app.

procedure TForm1.FormShow(Sender: TObject);
begin  
  Memo1.Clear;
  if ParamCount > 0 then
    begin
      case ParamCount of
        1: Memo1.Lines.LoadFromFile(Paramstr(1));
      else
         begin
           ShowMessage('Invalid Parameters');
           Application.Terminate;
         end;
    end;
end;

The code i am using is slightly different so that it opens into a listbox but this is the basis around it.

The problem is that i am only allowing on instance of my application to open as it uses mass's of memory to transfer files realy fast so if this happened twice on a computer it would just be crazy. And when i drag the item on it opens the app and opens the file. Yet if i run the command line and the app is already open it does nothing just refocuses on the app... Is there away to optimise my code or add a new procedure to the form so that it will open it even if its already open?? Thx


Related Articles and Replies:


[ Delphi Forum ]