Why cannot BHO receive the DocumentComplete(DISPID_DOCUMENTCOMPLETE) event again when I refresh the current page.

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



Answer this question

Why cannot BHO receive the DocumentComplete(DISPID_DOCUMENTCOMPLETE) event again when I refresh the current page.

  • laboremus

    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
  • ONeill

    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



  • Brandon Tucker

    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


  • Peter Gloor

    but how i know when the page is refreshed
  • Why cannot BHO receive the DocumentComplete(DISPID_DOCUMENTCOMPLETE) event again when I refresh the current page.