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

How do I run an external program

Status
Not open for further replies.

ddvlad

Programmer
Mar 12, 2003
71
RO
I have worked extensively in Delphi 3, especially with external programs. The problems started arising when I got Delphi 7. Can anyone tell me how I can run an external program? I also need command line parameters.
Help me please!
 
What do you mean...?
Shouldn't ShellExecute work?

ShellExecute(Handle,
'open',
pChar('FilePath&Name'),
nil,
nil,
SW_SHOWNORMAL)

This will execute and run an external program..

Should do the same work with earlier versions I assume..

mha
 
forgot to say..

you have to add if you are using ShellExecute

uses ShellAPI; //uses clause


mha
 
If you need to use command line parameters put them as the 4th parameter:

ShellExecute(Handle,
'open',
pChar('FilePath&Name'),
pChar('/parameter1 /parameter2 /parameter3')
nil,
SW_SHOWNORMAL)

Don't forget that if your filename / parameters have spaces in them they will need quotes...

Andrew
 
Thanks everybody. You've been a real help Life is a bad joke -- don't take it serious...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top