Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Start another Exe

Posted on 2001-08-02
7
Medium Priority
?
157 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 150 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Independent Software Vendors: 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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

916 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