Solved

How to exectue another program

Posted on 1998-10-24
1
125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

896 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now