Archive: Option to disable multiple instances?


Option to disable multiple instances?
hi

how can i make my setup executable only one time simultaneously? i mean, when somebody accidently tries to open the setup a second time that nothing happens

thx in advance

DOCa Cola


You can use FindWindow or write a registry key. Because of the race condition, it will in theory be possible to run 2 installers (in 0,0001% of the situations) :D

The really good way is to use a kernel mutex, maybe you can call CreateMutex with the System plugin. But for a simple check, that might be a bit overkill.


thx for the quick response
i have tried FindWindow, but the problem is, that the first opened window is same declared as the second one. i don't really like the idea of a registry entry, because when the installer fails one time, a user can never run the setup again.

and the kernel mutex, erm, that sounds a bit to complicated :)


Did you put FindWindow in .onInit? In .onInit, the window has not yet been created.

For the registry key, you can also write the $PARENTHWND and use IsWindow to see if it's still active.


thx! i will try that


Hm, yep that works
but not for the installer that uses "SilentInstall silent", any suggestions?


A silent install has no window, so you have to use the registry or a mutex.