Old 13th April 2006, 16:19   #1
Senior Member
Join Date: Oct 2005
Posts: 189
Exclamation 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.
dienjd is offline   Reply With Quote
Old 13th April 2006, 17:22   #2
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
It should have a counter in there so it loops say 100 times and then gives up.

Afrow UK is offline   Reply With Quote
Old 13th April 2006, 18:14   #3
Major Dude
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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 is offline   Reply With Quote
Old 13th April 2006, 18:48   #4
Senior Member
Join Date: Oct 2005
Posts: 189
Takhir, you are too nice to apps
Thanks for the plug-in link!
dienjd is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump