Archive: To determine whether ieexplorer.exe is running .


To determine whether ieexplorer.exe is running .
  I want to find out if any instance of internet explorer is running or not ? Can we do that in NSIS ? One possiblity here is that the IE window may not be open but it is still running in the background and we can see that in taskmanager.

Thanks
Neeraj


Sorry for the typo.
I meant iexplore.exe .


Have a look at FindWindow in the NSIS documentation.

-Stu


In my cases it is possible that iexplore.exe is running but there is no visible Window as the status is set to hiiden.
Hence I don't think we can rely on FindWindow ( Can we ??? ).
That is why I wanted to look for the ieplore.exe specifically .

Thanks
Neeraj


Status is set to hidden?
Do you mean minimized?

-Stu


Try this code below and say if it's working or not for you. $0 will return 1 if iexplore.exe is running, 0 if not.


FindWindow $0 "IEFrame"

>IsWindow $0 0 +3
StrCpy$0 1
Goto+2
StrCpy$0 0
>

FindWindow should work
  FindWindow searches registered windows classes and window object titles. Even if IE windows are minimized or invisible (although I don't think the latter typically happens) FindWindow will find them.

We use this in our installer to check for the presence of Visual Studio and our own program (what if someone is trying to update our program while it is still running?).

If you can get away with Window classes, that's probably better because you can also detect things like IE's embedded in other applications (although the user might be confused about which application he should shut down!).

I have attached a fragment of code from our installer that checks for three different window titles, giving the user a chance to close the app and try again or cancel the installer. You might find it handy. Note, too, how we use the macro ${PROGRAM_NAME}. You could either define this macro or search/replace it with your program name.

==================================================

; Visual Studio and ${PROGRAM_NAME} must not be running
CheckVSinstances:
FindWindow $1 "" "Microsoft Visual"
IsWindow $1 0 +2
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "You must close all running instances of Visual Studio$\nbefore installing ${PROGRAM_NAME}." IDCANCEL AbortRunning IDRETRY CheckVSinstances
FindWindow $1 "" "Microsoft Development"
IsWindow $1 0 +2
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "You must close all running instances of Visual Studio$\nbefore installing ${PROGRAM_NAME}." IDCANCEL AbortRunning IDRETRY CheckVSinstances
FindWindow $1 "" "[${PROGRAM_NAME}]"
IsWindow $1 0 +2
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "You must close all running instances of ${PROGRAM_NAME}$\nbefore installing an upgrade to ${PROGRAM_NAME}." IDCANCEL AbortRunning IDRETRY CheckVSinstances
goto NoCH
AbortRunning:
Abort "Installation Terminated. Run this installer again if you change your mind."
NoCH: