Solved

Executing another Program

Posted on 2001-08-22
10
151 Views
Last Modified: 2010-04-06
Hello
i want to execute another program from a command or procedure from my Delphi Program..


Example how do i start a program called  Happyface.exe
its in C:\

thanks in advance neopolis
0
Comment
Question by:neopolis
  • 4
  • 4
  • 2
10 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6412604
uses shellapi;

procedure TForm1.Button1Click(Sender: TObject);
begin
  shellexecute(Handle,'open',pchar('Happyface.exe'),nil,nil,sw_ShowNormal);
end;
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6412609
sorry just change the exe file to contain the path like

pchar('c:\Happyface.exe')
0
 

Author Comment

by:neopolis
ID: 6412690
I get undeclared identifier: 'Handle'
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6412703
try
  Form1.Handle

or any form you are using

which version of delphi u r using?
0
 

Author Comment

by:neopolis
ID: 6412733
I get undeclared identifier: 'Handle'
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 10 total points
ID: 6412737
try using WinExec, but this function is provided for compatibility with earlier versions of Windows.
WinExec(pchar('c:\Happyface.exe'),sw_ShowNormal)
0
 

Author Comment

by:neopolis
ID: 6412740
the program i am writing does not have forms or buttons
its a dll i am using Delphi 5
0
 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 6412866
Maybe you can use FileExecute() :
Example : FileExecute('NotePad',strFileName,strFilePath,esNormal);

Best regards,
The Mayor
0
 

Author Comment

by:neopolis
ID: 6412868
thanks the WinExec works for me i am win 98
thanks
0
 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 6412873
Oops,
forgot to mention that this is a function which comes with the RxLib, and that you have to declare RxShell in the Uses-Clause.

Maybe after all, this is not what you are looking for.

The Mayor
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
my activex application give System Error.  Code: 5.  Access is denied 16 120
Run video youtube webbrowse 10 61
Downloading email attachments 2 72
select query - oracle 16 100
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

11 Experts available now in Live!

Get 1:1 Help Now