Archive: Closing IE7 problem


Closing IE7 problem
Hi,
i have an installer which needs to close all internet explorer windows prior to installation. I had no problem with IE6 but i ran into problems with IE7. I can close IE7 in case no tabs were used. The problem occurs only when there are several tabs and the installer tries to close such IE window. IE7 pops up a question if you want to close all tabs. These pop up is flaring so much that i cant even click to proceed. I guess it is because the code for closing multiple IE windows is in a loop.

Do you have any idea how to force IE7 to close even if there are mor than one tab or any other way how to handle this?

Thank you very much for your help

Have a look at my code:

!macro CLOSE_IE
;Closing all IE Windows
loop:
FindWindow $0 "IEFrame"
IntCmp $0 0 done
IsWindow $0 0 done
System::Call 'user32::PostMessageA(i,i,i,i) i($0,${WM_CLOSE},0,0)'
Sleep 100
Goto loop
done:
!macroend


maybe the wm_command for File>Exit doesnt show the warning, or a command that closes all(or all except active) tabs


WM_SYSCOMMAND SCCLOSE may help. Or plug-in http://nsis.sourceforge.net/FCT_plug-in with /SCCLOSE key defined.


Hi Takhir,

thank you for your answer. I tried to test your FCT_plug-in, but when i try to compile the IE.nsi i am always getting the following error:

Invalid command: fct::fct
Error in script ie.nsi" on line 16 -- aborting creation process

What do i need to do in order to make it compile?


put included fct.dll to your program files\nsis\plugins folder ;)


Great, that works :-)
Thank you

Is it also possible to have the fct.dll in a different location? So that i define the location of the fct.dll inside the script and load it?


If we are talking about plug-in location on the user's comp, CallInstDll from Manual 4.11.3 'Calling plug-ins manually' should help.


You could just set the registry keys telling IE7 to display the close tabs dialog to NOT display that dialog and then set them back afterwards. A lot easier and safer than using a plug-in.

I think the reg values are in HKCU\Software\Microsot\Internet Explorer\TabbedBrowsing , but I forgot the value name.


that would probably not work, I would guess that IE reads the value at startup only


Originally posted by Anders
that would probably not work, I would guess that IE reads the value at startup only
That would make sense, but IE seems to read it on the go, so it does work, as of build 7.0.5700.5

The value is:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing "WarnOnClose"

It's a DWORD where 1 means to show the dialog and 0 means not to.

Re: Closing IE7 problem

Originally posted by M-Force

Have a look at my code:

!macro CLOSE_IE
;Closing all IE Windows
loop:
FindWindow $0 "IEFrame"
IntCmp $0 0 done
IsWindow $0 0 done
System::Call 'user32::PostMessageA(i,i,i,i) i($0,${WM_CLOSE},0,0)'
Sleep 100
Goto loop
done:
!macroend [/B]
M-Force, there is a potential for your macro to get stuck in an infinite loop. If IE has a dialog window open (like Internet Options, About, etc.) it will not respond to WM_CLOSE messages.

You can prevent this from happening by doing something like this:

StrCpy $R0 0 ;counter
loop:
FindWindow $0 "IEFrame"
IntCmp $0 0 done
IsWindow $0 0 done
System::Call 'user32::PostMessageA(i,i,i,i) i($0,${WM_CLOSE},0,0)'
Sleep 100
IntOp $R0 $R0 + 1 ;increment counter
IntCmp $R0 50 done ;break loop in case close fails
Goto loop
done:

I just picked 50 as an arbitrary high number. If a user had over 50 IE windows open they are probably crazy and wouldn't have enough memory free to install your app anyway.

Hey Guys,

thank you very much for all you interesting and helpfull answers.
I tested out all the solutions and decided that changing the registry key temporarily works best for me.

Thanks again