Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to trap Refresh of Webbrowser ?

41 views
Skip to first unread message

Roland

unread,
Oct 19, 2004, 1:47:19 AM10/19/04
to
Hello All
I have s IWebBrowser pointer and with it I sinked the events of
webbrowsers.According to DISPID , I am calling event handlers. I am
able to trap Document Complete, Download Complete events. How can I
trap the event of Refresh ( When the user refreshes the current page
). Is there any DISPID associated with it ?

Igor Tandetnik

unread,
Oct 19, 2004, 10:12:44 AM10/19/04
to
"Roland" <ajay.s...@gmail.com> wrote in message
news:69c0226e.04101...@posting.google.com

No, there is no special event. It is difficult to reliably catch
refresh. It does not fire the standard complement of events, only
DownloadBegin and DownloadComplete. If you get a DownloadBegin event
without any prior BeforeNavigate2, most likely a refresh has just
started.

I've seen claims that one can implement IOleCommandTarget on the client
site object, and WebBrowser will call Exec(OLECMDID_REFRESH) upon
refresh. I haven't tried it myself.
--
With best wishes,
Igor Tandetnik

"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage


CJL

unread,
Nov 9, 2004, 10:09:03 AM11/9/04
to
Hi,

You can trap the refresh by using the IDocHostUIHandler inteface.
It has a method called TranslateAccelerator. For a refresh (F5) this is
called with a cmdid of 6041. Return S_OK from this function to suppress the
refresh.

You can pass this interface to mshtml through the ICustomDoc interface.
This interface is obtained through a QueryInterface on the document.

Hope this helps,

CJL

0 new messages