Solved

Start another Exe

Posted on 2001-08-02
7
150 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 96
FMX StringGrid1->Canvas->FillRect Problem 3 176
PHP preg_replace code convert to Delphi 14 68
Delphi: sending SMS on android platform 1 38
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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