Re: How to close/destroy IWebBrowser cleanly ?
- From: "Larry Gillstrom" <lgillstrom@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 Jun 2006 14:41:24 -0700
My solution to this problem was to add a NavigateClose() method to my base
browser window class. It navigates to a stream before closing. It then
loads the following HTML string from the stream:
<script type='text/javascript'>
function onLoad() {
oClose = document.getElementById('close');
oClose.click();
}
</script>
<HTML >
<BODY bgcolor=0 SCROLL='no' onload='onLoad()'>
<CENTER>
<span id='close' name='close'>
Close
</span>,
</CENTER>
</BODY>
</HTML >
My browser class has the ability to accept parent window callbacks for HTML
events, so when the parent window is notified that the close element was
clicked it hides itself, sets a timer for 2 seconds then closes itself from
the TimerProc. This guarantees that nothing is going on in the browser when
the parent window closes. The 2 seconds is arbitrary and might need to be
modified based on circumstances.
A serious hack, I know. But believe me, I tried many other ways before
settling on this.
Larry
"Emmanuel" <emmanuel.caradec@xxxxxxxxx> wrote in message
news:1150708662.337651.80520@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
When the WebBrowser2 component close, some threads continue to work :
- sound continue to play even after ExitInstance (resulting in
unstoppable sound playing without any window )
- requests continue to be processed (resulting in opening many IE
instance in one case on a page refreshed automatically )
Forcing a navigation, like navigate("about:blank"), close the threads
but I'm worried, it could do something worse unexpectly.
The issue seem related to WM_PARENTNOTIFY not beeing sent to "Internet
Explorer_Hidden".
The issue affect all the little browser applications I tried. It's easy
to reproduce : Generate a template MDI project with an htmlview and
point the view to http://www.flashsound.com then close the childview.
This is an exemple : most page with flash have the same issue. I may
miss something since IE and Maxthon are working ok. Any ideas ?
Manu
.
- References:
- How to close/destroy IWebBrowser cleanly ?
- From: Emmanuel
- How to close/destroy IWebBrowser cleanly ?
- Prev by Date: Re: WebBrowsing: Pause while Downloading
- Next by Date: Detect IMG tags as they are added and/or removed from a document
- Previous by thread: Re: How to close/destroy IWebBrowser cleanly ?
- Next by thread: Webbrowser Back/Forward stack
- Index(es):
Relevant Pages
|
|