timmalos Posted July 7, 2011 Share Posted July 7, 2011 (edited) Hey guys. I use Internet explorer object and i need to avoid the user to close IE. I tried : I'm asked if i Really want to close the window and warned that it will close My software too, but IE still close even if i answer NO. $EventObject = ObjEvent($oIE,"IEEvent_","DWebBrowserEvents2") $EventObject2= ObjEvent($oIE, "IEEvent2_") Func IEEvent2_Quit($e) ;Some actions to prevent IE from closing If _Msg("Etes vous certain de vouloir fermer cette fenêtre? Cela fermera également le créateur de simulation.") Then _IEClose() Exit EndIf EndFunc I also tried a _IEAction($oIE,'stop'), and a fire to OnQuit Event (http://msdn.microsoft.com/en-us/library/aa768340%28v=VS.85%29.aspx) Even if MSDN say that Fires before the Windows Internet Explorer application quits, i don't manage to avoid IE from closing. Func IEEvent_OnQuit($e) ;Some actions to prevent IE from closing If _Msg("Etes vous certain de vouloir fermer cette fenêtre? Cela fermera également le créateur de simulation.") Then _IEClose() ;Some more actions Exit EndIf EndFunc Result is same as above, MsgBox is well showed but IE close before i can do anything to prevent it. My goal is that if user answer no, No action is did, and IE is kept opened. Some ideas? Thx a lot, Tim Edited July 7, 2011 by timmalos Link to comment Share on other sites More sharing options...
Tripredacus Posted July 7, 2011 Share Posted July 7, 2011 Have you looked into alternatives for your program? If you run it in an HTA using MSHTA.exe it uses everything that the built-in IE uses but as a separate process. That way your program can run even without IE being open. And since you run as an HTA you can script whether or not you can have the ability to close it, or even script the close button to do whatever you want. Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
wakillon Posted July 7, 2011 Share Posted July 7, 2011 You didn't show your _Msg function...And if it close your script, instead of close IE, you can hide it : _IEAction ( $oIE, "invisible" ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DaleHohm Posted July 8, 2011 Share Posted July 8, 2011 (edited) See Dale Edited July 8, 2011 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
timmalos Posted July 18, 2011 Author Share Posted July 18, 2011 Sorry for being late, was on holidays. Thx Dale works perfectly ! @Tripredacus I never heard about this, i will try to get more infos about this. @wakillon, _Msg is only an InputBox function with a Return value, thats why i didn't showed it. And i wanted to Prevent Ie from closing and not close it or hide it, But thx for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now