views:

381

answers:

2

is there a way to know when the user perform refresh to the page using the SHDocVw.WebBrowserClass of ie using C#

A: 

There can be a better way but you can consider using Before_Navigate it should be triggered by refresh as well.

EDIT :

I've just checked the documentation apparently refresh doesn't trigger these, sorry.

I think there is no easy to way to this, you might want to try the following component :

http://code.google.com/p/csexwb2/

It's a very nice webbrowser control implementation, using C++ for tricky parts, and got a refreshbegin event that you can use.

dr. evil
and how can i know when refresh complete?
Chen Kinnrot
NavigateComplete event
dr. evil
Be careful that this event will be triggered in every navigation not only refresh you might wanna check the URL to understand the refresh. I can't remember the parameters there can be an indicator in them as well.
dr. evil
I'm sorry its not working... not the before_nevigate and nevigatecomplete, i tried the before_nevigate2 and nevigatecomplete2 and its not working neither
Chen Kinnrot
you right, updated my answer, please see the edit.
dr. evil
A: 

If this is BHO you're writing then OnDocumentComplete event should be fired every time a page finishes loading, but you need to manage your own state and remember the last visited URL -- this way you will know Refresh from a navigation. Also, you need to check whether it's the main window or an IFrame that raises the event by comparing the source of the event with the browser pointer you have memorized in SetSite.

zvolkov
OnDocumentComplete event not fired on refresh
Chen Kinnrot