Archive: FindProc and MUI


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?


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


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?


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.


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.


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


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.


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


That could be it. Mine is 6/2/2004.


That was it. I figured it was something stupid like that.

Thanks everyone!