Re: How to close/destroy IWebBrowser cleanly ?



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



.



Relevant Pages

  • Re: Page layout for tubie pages on the net Re: Deep Space 845 55WSET amps.
    ... picture on the right ... Just to add a bit of explanation, the viewing browser might have ... browser will then word wrap to the viewer's window. ... in one cell and the text in another. ...
    (rec.audio.tubes)
  • Re: Clear all optgroups and options from a select list
    ... could not drag one window over the contents of another because the mouse ... responsive in either major browser. ... As far as the javascript ... specification is concerned the implementations that assert that they ...
    (comp.lang.javascript)
  • Re: NXP Gone mad
    ... responsible for the development of the new NXP site. ... displayed in a new window. ... - the NXP web site is particuarly Browser ... In one browser on visting the website after the SECOND invitation to the ...
    (comp.arch.embedded)
  • Re: Going back to original web page
    ... How to download and install HiJackThis: ... Replies are posted only to the newsgroup for the benefit or other readers. ... Yes, when I click on Open in A New Window, it ... if you just opened your browser and this ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • RE: VBA draw and erase lines (crosshairs) on form
    ... I do not mean a worksheet based form. ... launch an IE browser that will then go to a web site to display a chart. ... the ends of the browser window. ... Is Nothing Then Exit Sub ...
    (microsoft.public.excel.programming)