Solved

Start another Exe

Posted on 2001-08-02
7
151 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
[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
  • 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
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 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

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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