Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling A File When Opening Program... 1

Status
Not open for further replies.

PaidtheUmpire

Programmer
Jan 4, 2004
105
AU
Is there a way for Delphi to call a file while being openned?

Like this:

DelphiProg.exe DataFile.csv

Which would open the Delphi Program, while opening the second file "DataFile.csv" into a MemoBox in the Program?

Thanks for any help.
Paid The Umpire

Delphi, Delphi, Delphi. Oi! Oi! Oi!
 
Obviously some error checking would be in order, but:

Code:
procedure TForm1.FormCreate(Sender: TObject);

begin

  if paramcount > 0 then
      memo1.Lines.LoadFromFile(paramstr(1));

end;

Should do what you need.

paramstr(0) is the name of the executable and will therefore always exist - so paramstr(1) is the first command line parameter.

Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top