Prevent Multiple Instances

NSIS

Previous | Contents | Next

C.6 Prevent Multiple Instances

Put the following code in your .onInit function:

 System::Call 'kernel32::CreateMutex(p 0, i 0, t "myMutex") p .r1 ?e'
 Pop $R0
 
 StrCmp $R0 0 +3
   MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
   Abort

'myMutex' must be replaced by a unique value!

Previous | Contents | Next