Why cannot BHO receive the DocumentComplete(DISPID_DOCUMENTCOMPLETE) event again when I refr

I have written a bho object and sinked the events of IE.

when navigate to a new page,bho can receive the documentcomplete event.

but when I refresh the current page, bho cannot receive the event again,while bho can receive other event well. (I am sure then I havenot Unadvised the events)

who could tell me why?

[336 byte] By [kevin7776] at [2008-2-15]
# 1

How are you hooking to the event. When a page refresh happens you will need to rehook the event as the page will have been entirely destroyed and recreated.

Thanks
-Dave

DaveMassy at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 2
Unfortunately IE doesnt fire BeforeNavigate2 and DocumentComplete2 when the page refresh is clicked. There are several work arounds I found on the web (which are mainly guess works), but you may find this one close to what you might want to do http://www.codeproject.com/internet/detecting_the_ie_refresh.asp
SharathUdupa at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 3
but how i know when the page is refreshed?
kevin7776 at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 4

What works for me:

My BHO implements (among many other things) IDispatch and IOleObjectWithSite

In IOleObjectWithSite::SetSite, query for the connection point container, find the connection point for DIID_DWebBrowserEvents2, and advise with your BHO as reinterpret_cast<IDispatch*>

In your BHO, override the implementation of Invoke(). It gets called with DISPID_DOCUMENTCOMPLETE on a refresh.

Hope this helps,

Casper

cadi_threeships at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...