Lightning20
12th July 2005 10:27 UTC
Problem avoiding setup to run more than once at the same time
Hi !
I want to avoid my setup running more than once at the same time. I have tried to use both Findproc and kernel32 to find if my setup is already running or not. I have placed the code in my .oninit function. The problem is that when the setup is launched, it detects itself as running, and so it says me "I'm already running!" Is there a way to make it work? Thx !
System::Call 'kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK "The installer is already running."
Abort
or
FindProcDLL::FindProc "myinstall.exe"
StrCmp $R0 1 RunningInst_found RunningInst_notfound
RunningInst_found:
MessageBox MB_OK "The installer is already running."
Abort
RunningInst_notfound:
Joost Verburg
12th July 2005 11:36 UTC
Language strings are not yet set in .onInit. I recommend you to replace $(^Name) by a unique string that contains a GUID.
Lightning20
12th July 2005 13:28 UTC
Ok thank you for the information. I gave it a try but it still doesn't work. It says that install is running everytime. What can be wrong?
I have defined a unique string
LangString unique_string${LANG_FRENCH} "French"
>;here is the code in .oninit
>Function .oninit
System
::Call 'kernel32::CreateMutexA(i 0, i 0, t '$(^unique_string)') i .r0 ?e'
>Pop $R0
StrCmp $R0 0+3
MessageBox MB_OK "The installer is already running."
>Abort
FunctionEnd
>
Afrow UK
12th July 2005 13:53 UTC
When we mean a unique string, we mean a string that is the same for all languages (e.g. NOT a language string).
;I have defined a unique string
!define MutexString "blah blah"
;here is the code in .oninit
Function .oninit
System::Call 'kernel32::CreateMutexA(i 0, i 0, t '${MutexString}') i .r0 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK "The installer is already running."
Abort
FunctionEnd
-Stu
Lightning20
12th July 2005 14:50 UTC
Thank you again for your rapidity and for the accuracy of your answers ;)