Solved

Start another Exe

Posted on 2001-08-02
7
146 Views
Last Modified: 2010-04-06
I know this question has been asked many times but the search function of EE does not work worth a hill of beans so I will use my points to ask this question again.

How do I start another exe and kill the current exe. My application checks a folder on the network for an updated exe. If the version numbers don't match I want to copy the new one locally. This is not the problem. I am having problems starting the copy exe and then starting the application again.
All I need is the best code to start another exe and kill the current program. It needs to work on both Win95/98 and W2k Pro.

Ross
0
Comment
Question by:bozo7
  • 4
  • 2
7 Comments
 
LVL 4

Accepted Solution

by:
fva earned 50 total points
ID: 6345215
You don't need any fancy stuff to remotely kill no process.
Let your program check the versions itself. On new version detected, run the new version with some switch, telling it to perform the upgrade and make the running one end properly. The new version should (upon receival of the switch) wait for any instance of the caller to end, copy itself over the caller then invoke the (updated) caller without switches and terminate silently. This will surely work on any OS.

F.
0
 
LVL 1

Author Comment

by:bozo7
ID: 6345251
What is the best code to start the exe?
shellexecute?

Ross
0
 
LVL 1

Author Comment

by:bozo7
ID: 6345274
With the parameter? That is what is giving me troubles.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:bozo7
ID: 6345286
With the parameter? That is what is giving me troubles.
0
 
LVL 4

Expert Comment

by:YodaMage
ID: 6345308
I'd use CreateProcess.

var
  StartInfo : _STARTUPINFOA;
  ProcessInfo : _PROCESS_INFORMATION;


GetStartupInfo(StartInfo);
CreateProcess('*.exe', pchar('Command Line to execute'),
 nil,nil,false,CREATE_NEW_CONSOLE,nil,nil,StartInfo,
 ProcessInfo);

0
 
LVL 1

Author Comment

by:bozo7
ID: 6345312
With the parameter? That is what is giving me troubles.
0
 
LVL 4

Expert Comment

by:fva
ID: 6345571
I would agree with YodaMage; when I implemented this trick I used CreateProcess, too, but there are also other ways that could work. Stick with what seems more familiar to you.

F.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

12 Experts available now in Live!

Get 1:1 Help Now