- NSIS Discussion
- Closing IE7 problem
Archive: Closing IE7 problem
M-Force
25th August 2006 16:22 UTC
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
Anders
26th August 2006 20:21 UTC
maybe the wm_command for File>Exit doesnt show the warning, or a command that closes all(or all except active) tabs
Takhir
27th August 2006 12:11 UTC
WM_SYSCOMMAND SCCLOSE may help. Or plug-in http://nsis.sourceforge.net/FCT_plug-in with /SCCLOSE key defined.
M-Force
31st August 2006 15:36 UTC
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?
Takhir
31st August 2006 15:37 UTC
put included fct.dll to your program files\nsis\plugins folder ;)
M-Force
31st August 2006 15:46 UTC
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?
Takhir
31st August 2006 17:39 UTC
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.
dienjd
31st August 2006 20:01 UTC
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.
Anders
31st August 2006 23:22 UTC
that would probably not work, I would guess that IE reads the value at startup only
dienjd
31st August 2006 23:52 UTC
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.
dienjd
1st September 2006 04:06 UTC
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.
M-Force
1st September 2006 16:14 UTC
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