How to identify a browser refresh event

I’m currently writing a cool BHO ( Browser Helper Object ) and one of the things that I've noticed is that there seems to be missing a way to receive a Refresh event notification from the browser.

Why do I need a refresh event ? well its because the browser doesn’t raises a DocumentComplete event on a page refresh.

So what are the steps to receive a notification of a browser refresh event ?

1. Register to BeforeNavigate2, DocumentComplete, DownloadComplete events. 
2. Declare a global boolean by the name of refresh and give is the value of true.
3. On the BeforeNavigate2 event set the value of the boolean to false.
4. On the DocumentComplete event set the value of the boolean to true.
5. On the DownloadComplete event check the value of the boolean and if its true do whatever you want …

 

 

3 Comments

  • The only book that i know which cover bho is Programming Microsoft Internet Explorer 5 from MSPRESS isbn: 0735607818 it does not talk about writing bho in c# or vb6 but in c++ and explains the basics of how to register the bho and how to program it plus has lots of examples.

    Its very easy to program bho via .net, all you have to do is import the right com types and register it.

    Let me know what exactly are you trying to acomplished and i'll try to guide you of how to do it via .net

  • i have just implemented this system after having looked for a full day and i can verify that it works correctly. who knew it could be so simple?

  • Hi..

    I would realy like to know what kind of project type in c# should i use to create a BHO.

    I have some code sample for creating the interface...
    but i dont know with which project type should i compile it.

    thanks.
    Udi

Comments have been disabled for this content.