Archive: infinite loop possible in close all IE windows example


infinite loop possible in close all IE windows example
The wiki example showing how to close all IE windows can get caught in an infinite loop if an IE window has a dialog open.

For example, if you open IE, go to Tools, and select Internet Options, a settings dialog appears. If you then run the routine on the wiki page, it will loop through and infinitely keep sending WM_CLOSE messages to IE, which will all be ignored.

The only way I'm aware of to be sure that you will close all IE instances is to kill all iexplore.exe processes. This will cause all IE windows to die, even if they have dialogs open.

I would recommend Instructor's nsprocess plug-in. I haven't used it, but he says it can "Kill all processes with specified name (not only one)", so it should do the trick :)

Note: this infinite loop possibility is not only present in this particular example. To be safe, you can set an upper limit of the number of times you want to loop and exit out of the loop if that is reached.


It should have a counter in there so it loops say 100 times and then gives up.

-Stu


Find-Close-Terminate plg-in enumarates windows and first attempts to close applications (WM_CLOSE), if app. still running - terminates it. Bad idea to 'terminate' app as a first step (if we can find it's window). From KillProcDll plug-in description: "The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess."


Takhir, you are too nice to apps :p
Thanks for the plug-in link!