Skip to content
⌘ NSIS Forum Archive

Extend preventing multiple instances

2 posts

Bobbie100#

Extend preventing multiple instances

I'm using the preventing multiple instances code in the archive (see below)
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
I want to extend this by adding code between the MessageBox and the Abort to bring up the original instance as the foreground window, including restoring the window if it is currently minimized.

Anyone know how to do this?
Afrow UK#
  System::Call 'kernel32::CreateMutexA(i 0, i 0, t "MapUpdater") i .r1 ?e'
Pop $R0

StrCmp $R0 0 NotRunning
FindWindow $1 "" "Install Title"
System::call "user32::SetWindowPos(i r1, i -1, i 0, i 0, i 0, i 0, i 0x02|0x01) i.r1"
Pop $1
Abort
NotRunning:
-Stu