1 unit Unit1; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls; 8 9 type 10 TForm1 = class(TForm) 11 procedure FormCreate(Sender: TObject); 12 private 13 { Private declarations } 14 public 15 { Public declarations } 16 end; 17 18 var 19 Form1: TForm1; 20 21 implementation 22 23 {$R *.dfm} 24 25 // open an file with the project to test it. 26 // if a file is available an message will appear. 27 28 procedure TForm1.FormCreate(Sender: TObject); 29 var 30 S : string; 31 begin 32 // Get commandline 33 S := CmdLine; 34 // Remove the application path from CmdLine, +3 = "" and space 35 Delete(S,1,length(Application.ExeName)+3); 36 if length(S) > 0 then 37 begin 38 // Found filename 39 Showmessage('Found File : ' + S); 40 end; 41 end; 42 43 end.