Talk:CreateMutex plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
Check out this code: | Check out this code: | ||
<nsis | <nsis> | ||
; Just a key to store a window handle in | ; Just a key to store a window handle in | ||
Line 29: | Line 29: | ||
FunctionEnd | FunctionEnd | ||
</nsis | </nsis> | ||
This code also brings the running instance of the installer to the foreground if starting another instance. | This code also brings the running instance of the installer to the foreground if starting another instance. |
Revision as of 16:08, 20 January 2006
No real need for this plugin as the System.dll plugin alread can do this. Check out this code:
<nsis>
- Just a key to store a window handle in
!define PLUGIN_INSTREGKEY "Software\My Company\My Product"
Function .onInit
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "NxSBalloonTipPluginSetup") i .r1 ?e' Pop $R0
StrCmp $R0 0 noprevinst ReadRegStr $R0 HKCU "${PLUGIN_INSTREGKEY}" "WindowHandle" System::Call 'user32::SetForegroundWindow(i $R0) i ?e' Abort
noprevinst:
FunctionEnd
Function .onMyGUIInit
WriteRegStr HKCU "${PLUGIN_INSTREGKEY}" "WindowHandle" "$HWNDPARENT"
FunctionEnd
Function .onGUIEnd
DeleteRegValue HKCU "${PLUGIN_INSTREGKEY}" "WindowHandle" DeleteRegKey /ifempty HKCU "${PLUGIN_INSTREGKEY}"
FunctionEnd
</nsis>
This code also brings the running instance of the installer to the foreground if starting another instance.