Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Executing another Program

Posted on 2001-08-22
10
Medium Priority
?
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 30 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

688 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