Is there a way to make a running program update itself, via the Inno setup installer? Or is it necessary to quit the running program before it can be upgraded?
Asked
Active
Viewed 1,672 times
1
-
It's not necessary, but much better to quit your application before you overwrite its binary file. – TLama Sep 01 '13 at 15:06
-
@TLama, why is it better? Is it even possible to overwrite the binary file it the app has not quit? Since you are an Inno setup insider, I have really high hopes now! :) – Prof. Falken Sep 01 '13 at 15:12
-
1. Because not always you'll be able to move the old binary file and copy the new version of it, or there might be the situation when the other stuff used by your application needs to be replaced while your (still running) old version won't be able to understand them (e.g. a DB schema update). 2. You may (attempt to) move the old file (e.g. by renaming) and copy the new one. So yes, it is possible if you're lucky enough. 3. That insider means that I was building a few custom versions of InnoSetup making many internal changes :-) – TLama Sep 01 '13 at 16:45
-
1Related question: [How to automatically update an application installed with Inno Setup](https://stackoverflow.com/q/53073973/850848). – Martin Prikryl Nov 02 '20 at 07:33
1 Answers
3
You can always write a script in your Inno Setup Update Installer that will check if app is running and close it automatically before update (FindWindowByClassName
or FindWindowByWindowName
). Or the better way is to create Mutex in you app and then to use CheckForMutexes function.

RobeN
- 5,346
- 1
- 33
- 50
-
1For mutex is easier to just specify the [`AppMutex`](http://www.jrsoftware.org/ishelp/index.php?topic=setup_appmutex) directive. – TLama Oct 24 '14 at 19:23