Can I prevent the user from running multiple instances of the installer?

From NSIS Wiki

The best way is to use a kernel mutex. You can call the Win32 API using the System plug-in. Put this code in the .onInit function:

System::Call 'kernel32::CreateMutex(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."

'myMutex' should be replaced by a unique value (e.g. ProgramSetup.exe).
See also System Plugin Example: Allow only one installer instance

Personal tools