HTMLWindowEvents2 onscroll event not getting fired

HTMLWindowEvents2 onscroll event not getting fired

Post by Zach » Mon, 07 Mar 2005 06:39:16


I have some C++ / ATL objects which are trying to capture the onscroll
event of whatever page(s) is/are being displayed to the user. My basic
flow of setting up this event handlers are:

1) Sink with the DWebBrowserEvents2 of the pointer that is given to the
SetSite() method of my Browser Helper Object.
2) In DocumentComplete(), get a pointer to the IHTMLWindow2 interface
associated with the IWebBrowser2 object given to me. Sink with
HTMLWindowEvents2 on this pointer using AtlAdvise.
3) In BeforeNavigate2, disconnect from the sink on the IHTMLWindow2
interface by using AtlUnadvise.

Now, on about 95% of webpages, this will allow me to catch onscroll
events for every frame in the page. However, on some webpages onscroll
does not get fired AT ALL. One particular page that this happens on is
www.yahoo.com. Even though AtlAdvise returned S_OK, the
IDispatch::Invoke that I passed it never gets called with
DISPID_HTMLWINDOWEVENTS2_ONSCROLL. This IDispatch interface DOES get
called with other events, such as onunload, etc. It seems like only
the onscroll method is not working correctly.


Is there some reason this might be happening? Could it be a bug in
Internet Explorer? Or maybe the HTML of the webpage can specify
something that prevents these events from getting fired?

Any advice appreciated.

Sincerely,
Zachary Turner