I did something similar in this way.  B.exe periodically checks for an update.  
If it finds one, it waits until it's idle, starts A.exe (via CreateProcesss), 
and quits.  A.exe makes a backup copy of B.exe, deletes B.exe (may have to wait 
in a loop) and creates the new B.exe.

In my case B.exe is a COM server, so A.exe doesn't start it.



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Bobby Clarke
Sent: Thursday, January 15, 2009 9:09 AM
To: [email protected]
Subject: [delphi-en] Problem with ShellExecute

I wanted to provide a web update facility for my program B.exe and decided that 
the easiest way was to write a small control program, A.exe, which checked the 
web for updates to program B.exe and then starts, via ShellExecute, the latest 
version of B, perhaps B009.exe.

This all works very well. The problem comes when I try to update the control 
program A.exe. Clearly the new version must be called A.exe so that all the 
shortcuts work. I can download A.new and the only task now is to delete A.exe 
and rename A.new to A.exe. I have written a small console program C.exe that 
does this. The problem is knowing how to start C.exe. If I start with a 
ShellExecute from A.exe, the file A.exe seems to be locked even after A has 
finished and even if C.exe waits for two minutes before trying to change the A 
filenames. The A filenames themselves are not locked as I can change using 
Windows Explorer during the  2 minute wait. I can even change the names by 
hand-starting a different occurrence of C.exe. Starting C from B fails as the A 
file is still locked.

I could place C.exe to be run on the next re-boot, but this seems messy and 
interferes with the user's control of his PC. Is there another option? All 
suggestions welcome. How do others update programs using the web?


Bobby Clarke


[Non-text portions of this message have been removed]


------------------------------------

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [email protected]! Groups Links



Reply via email to