0

I have application written on C++, and I want to be able to update it like Google Chrome does:

  • Silently download new version from server,
  • replace original files and
  • restart app.

I also want to replace exe file, that locked as it in use now. Couldn't find any solution for this type of autoupdate.

Maybe wxWidgets have such tools?

Or maybe you know, how to do this?

Scott Bennett-McLeish
  • 9,187
  • 11
  • 41
  • 47
Neka
  • 1,574
  • 4
  • 22
  • 36
  • Is there a way to do this with single entry point (application) without any another launcher.exe or updater.exe? – Neka May 28 '15 at 05:55
  • Maybe, there is the way to unclock exe-file from itself, and replace it? Anyway, OS loads all it need to the RAM. So it is not need actual file on the disk anymore. – Neka May 28 '15 at 06:00
  • No, the OS does not necessarily load the whole file into RAM at once. See [this answer](http://stackoverflow.com/a/3898854/440119), for example. – Benjamin Lindley May 28 '15 at 06:14

3 Answers3

0

Make 2 programs. Your primary application, and a launcher. The launcher is what people should click on to start your program, and it is responsible for starting the primary application, and then can shut itself down. If you need to update while the primary application is running, you can download the updated program to a separate file, along with any other files necessary. Then the primary application can launch the launcher and shut itself down. The launcher then is responsible for deleting the old program and renaming the new one, and relaunching it.

Actually, this doesn't even have to be two different programs. It can be the same program operating in two different modes (selected through command line arguments, for example). You still need 2 copies of the executable file on disk though. Note that this is precisely what Google Chrome does.

Benjamin Lindley
  • 101,917
  • 9
  • 204
  • 274
0

The theory is described in the comment above. In practice, you should have a look at WinSparkle.

VZ.
  • 21,740
  • 3
  • 39
  • 42
0

Package your program as an MSI file (Windows installer). Then download your new msi file and launch it. Windows installer takes care of updating your program and you can author the installer to relaunch your app.

Take a look at http://wixtoolset.org/ for how to build your installer.

villintehaspam
  • 8,540
  • 6
  • 45
  • 76