Skip to content
⌘ NSIS Forum Archive

Single installer instance

3 posts

aloknarula#

Single installer instance

Hi,

Can anybody tell me how to restrict launch of installer if one instance is already running.

Thanks in advance.
Alok
aloknarula#
Got it.

Put the following code in your .onInit function:

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
Pop $R0

StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
'myMutex' should be replaced by a unique value.