Solved

How to exectue another program

Posted on 1998-10-24
1
126 Views
Last Modified: 2010-04-06
Hi,

This is probably a very simple question for you experts, but I'm lost.

What command/syntax do I use to run another program (that I have created) on a button click event and close the one I ran it from?
Must I supply the path to it?

Thanks
0
Comment
Question by:edans
1 Comment
 
LVL 1

Accepted Solution

by:
borup earned 20 total points
ID: 1344179
You can do this calling the API function ShellExecute.

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShellExecute(Application.Handle,nil,'c:\command.com',nil,nil,SW_SHOWNORMAL);
Application.Terminate;
end;

Remember to include shellAPI in your uses statement.

borup
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question