Talk:Allow only one installer instance: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Saivert]]
[[User:Saivert]]
You can also put the value of $HWNDPARENT variable in a registry key and then use this in a second invocation of the installer to bring the original installer window to front. Like in this example:
You can also put the value of $HWNDPARENT variable in a registry key and then use this in a second invocation of the installer to bring the original installer window to front. Like in this example:



Revision as of 07:23, 14 September 2005

User:Saivert You can also put the value of $HWNDPARENT variable in a registry key and then use this in a second invocation of the installer to bring the original installer window to front. Like in this example:

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
Pop $R0 
 
StrCmp $R0 0 goahead
  MessageBox MB_OK "The installer is already running." 
  ReadRegStr $R0 HKLM "Software\MyApp" "installerhwnd"
  System::Call 'user32::SetForegroundWindow(i R0) i ..'
  Abort
goahead:
WriteRegStr HKLM "Software\MyApp" "installerhwnd" $HWNDPARENT

Hope this helps further....