• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Updating the Application's EXE file

I would like my Application to check, every time it runs, if there's a newer version of it on the company's intranet, and if there is a newer version, it should replace itself with the new version. (Download the new EXE app version, and replace the old EXE file).
If there's a new version, it should terminate itself and run the new version.
Next time the APP runs, the new EXE file should run.

I can deal with checking for a new version, and downloading it via HTTP.
But, how do I replace the EXE file which is now running with a newer version? Is it a safe thing to do ? How can I do it in another way, if not? (I want the EXE replaced, not to just D/L and run it each time).
  • 2
1 Solution
There should be no problem:
1. Mark your "old version" as "dirty"
2. Hide your old form (window) from user interface.
3. Put up message: downloading new version.
4. Download new version.
5. Run new version (from old one).
6. Have new version tell old one it's up. (via pipe or win32 message or winsock or shared file or whatever), and shut down.
Or... Just shut down after some timeout...

Calling the Exec Program on the disk should have nothing to do with your process (running program) in memory.

The problem will be with file sharing.
You may not be able to overwrite or delete the file that's running.
The easiest way is to simply use 2 alternate names. If you are Proj1 download and run Proj2. If it's proj2 download and run proj1.

Another completely different approach:
Make a small extra program: CheckVersion.
It will run from your oldProj. If it finds newer version it closes oldProj (either sends message telling it to shut itself, or sends it a Win32 terminating message) and downloads and runs newer version.
Symantec have a program like this in their Visual Java program. It constantly (once every so and so) monitors the net, and checks for a newer version.

Hope this helps, Moshe
xozAuthor Commented:
How do I send a message telling the App to shut itself ?
How do I send a win32 terminating message?
Maybe easier:
Have the app (once it notices the newer version) shell out a small app designed just for this transfer and end itself. The small app should now download the new exe. Once the it is downloaded, shell it and have the small app end itself.

xozAuthor Commented:

Now just for general knowledge:
How do I send a message telling the App to shut itself ?
How do I send a win32 terminating message?

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now