I'm using C#, MSHTML and InternetExplorer objects to run through a webpage, but I'm snagged on an issue.
Basically, I've noticed that in IE7 or earlier, when window.showModalDialog is called, then the NewWindow3 event is triggered.
In IE8 and IE9, NewWindow3 is never triggered. As MSDN writes: "The NewWindow3 event is only fired when a new instance of Internet Explorer is about to be created. Calling showModalDialog or showModelessDialog does not trigger an event because they are not new instances of Internet Explorer. They are implemented as MSHTML host windows, which allows them to render and display HTML开发者_运维问答 content but not hyperlinks between documents." (http://msdn.microsoft.com/en-us/library/aa768337(v=VS.85).aspx)
The only way I've been able to come close to capturing the modal dialog being triggered - but I have no access to the actual modal object - is using the WindowStateChanged event. This event is routinely called, yet I've noticed that when dwFlags == 1 and dwValidFlagsMask==3, this is usually when the browser is deactivated due to a modal dialog...
Now, all I need to know is how to get that modal dialog object. Any help would be greatly appreciated
Turns out it all depends on your Windows UAC settings. For security reasons, when your UAC is set to medium or higher, UAC prevents access of modal dialogs. Lowering these settings allows full access to the modal dialog, through the NewWindow event
精彩评论