Allow only one installer instance: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library)
 
m (Updated author and download links, and changed format of some pages.)
Line 14: Line 14:
'myMutex' should be replaced with a unique value.
'myMutex' should be replaced with a unique value.


Page author: Vytautas
Page author: [[User:Vytautas|Vytautas]]

Revision as of 12:40, 23 April 2005

Description

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:

The Script

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

'myMutex' should be replaced with a unique value.

Page author: Vytautas