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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Programs

Status
Not open for further replies.

MinalMaurice

Programmer
Apr 20, 2005
14
0
0
GB
The last lot of help I had was great.

One more request.

How do I start a .exe file from within Delphi, and can I link to it?
 
hi

I use CreateProcess for this purpose, not the easiest to use. Try searching this forum for CreateProcess threads.

When you say 'link to it', what do you mean exactly?

lou
 
Here's an example of how to run excel and open a file:

Code:
procedure TForm1.Button1Click(Sender: TObject);
// uses ShellApi
var executablefilenameS : string;
var parameterfilenameS : string;
begin
 executablefilenameS := 'C:\Program Files\Microsoft Office\Office10
\excel.exe';
 parameterfilenameS := 'myexcelfilename.xls';
 ShellExecute( 0, 'open', PChar( executablefilenameS ), PChar( 
parameterfilenameS ), nil, SW_SHOW );
end;

Peter
 
Or if you are new, Borland provide a libary of useful file routines one of which is ExecuteFile('filename','params','dir',showlevel);
this can be found in the Delphi/Demos/doc/filemanex folder, you dont need to cast anything to pchars to use it just include FmxUtils.pas in your project and FmxUtils in your 'uses' clause.


Steve: Delphi a feersum engin indeed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top