- NSIS Discussion
- FindProc and MUI
Archive: FindProc and MUI
muggz77
13th July 2005 23:34 UTC
FindProc and MUI
Is there an issue using FindProcDLL and the MUI?
I have a script that uses FindProc to detect if my application is running before attempting to replace the exe, and it worked fine when I was not using MUI. Now I have switched to use MUI and now the FindProc call always returns 0 even if the exe is running.
FindProcDLL::FindProc "MyApp.exe"
StrCmp $R0 1 0 +3
MessageBox MB_OK "Close MyApp and retry this install."
Quit
Does anyone have any suggestions?
Afrow UK
13th July 2005 23:40 UTC
You could try the old fashioned way:
FindWindow $R0 "" "MyApp Window Title"
IsWindow $R0 0 +3
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Close MyApp!" IDRETRY -2
Abort
-Stu
muggz77
13th July 2005 23:52 UTC
Thanks for the quick reply Stu!
That works fine for now, but in the future the title of the window may change dynamically. Is there a known issue with FindProc that prevents it from being used with MUI? Is there another way I can determine if a process is running by the name of the exe?
Joost Verburg
14th July 2005 00:57 UTC
The MUI is just an interface and should have no effects on standard script code. Please attach a minimal example that reproduces the problem.
It looks like what you are trying to do can be done in an easy and more reliable way using a mutex.
muggz77
14th July 2005 01:13 UTC
That is what I assumed, but I can't get FindProc to work correctly when using MUI. Maybe I'm missing something stupid, it wouldn't be the first time.
In this script, I check for iTunes because I am running it, and it skips right thru, as if it doesn't detect it running.
Afrow UK
14th July 2005 14:07 UTC
I don't think the title for FindWindow has to be the complete title, just some of it. Also, you can pass it a window handle too (not sure which param it is) but for Internet Explorer it's ieframe (somthing like that).
-Stu
Homer1969
15th July 2005 20:39 UTC
Muggz, I ran your script checking for notepad.exe (since I don't have itunes) and it ran as expected. Stopped when notepad was running and went on through when notepad wasn't running.
muggz77
15th July 2005 20:44 UTC
That is odd, it doesn't work for me. Maybe I have an old version of the dll? The last mod date for my dll is 12-25-03
Homer1969
15th July 2005 20:55 UTC
That could be it. Mine is 6/2/2004.
muggz77
15th July 2005 21:02 UTC
That was it. I figured it was something stupid like that.
Thanks everyone!