Problem with CreateMutexA and detecting an application running
I have searched most of the messages that I could find referencing the createmutexa function for detecting if an application is running (as well as the FindWindow versions) but I could not seem to resolve this issue.
What I want is to detect 2 instances:
1. Whether the installer is running
2. Whther the application I am installing is actually running.
I can use the one instance already supplied on the FAQ for detecting the installer without issue. When attempting to use the CreateMutexA again It detects the application is running and posts the Retry Cancel options but the Retry always believes the actual application is still running even when it has been killed?!? It is in a loop somehow with the again: label before the CreatMutexA command is executed again apparently and I do not know why?
Here is my Code Script:
If someone can point out what I am doing wrong or how I can do it differently (other than FindWindow since window name has not been officially established as yet") I would appreciate the help.onInit
::Call 'kernel32::CreateMutexA(i 0, i 0, t "${PRODUCT_NAME} Installer") i .r1 ?e'
System
Pop $R0
StrCmp $R0 0+3
MessageBox MB_OK "${PRODUCT_NAME} installer is already running"
Abort
again:
>System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${PRODUCT_NAME}") i .r1 ?e'
Pop $R1
StrCmp $R1 0+3
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "${PRODUCT_NAME} must not be running in order to proceeed with installation" IDRETRY again IDCANCEL
Abort
FunctionEnd
>
Thanks