Solved

Start another Exe

Posted on 2001-08-02
7
152 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

617 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