By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,310 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,310 IT Pros & Developers. It's quick & easy.

handling onscroll event of WebBrowser

P: n/a
Hi Group
I'm writing an Internet Explorer plugin. Everything works well, except
when I try to handle the onscroll event.
>From MSDN it seems that IHTMLWindow2.onscroll property is the way to go
another possibility seems to exist with IHTMLElement2.onscroll using
the document body, but this does not solve the problem.

the following code snippet compiles but when executed it always throws
a System.NotImplementedException
this is the stack trace:
in mshtml.HTMLWindow2Class.IHTMLWindow2_set_onscroll( Object p)

this is the code:
//WebBrowser is a valid instance of SHDocVw.WebBrowserClass
this.WebBrowser.DocumentComplete += new
DWebBrowserEvents2_DocumentCompleteEventHandler(we bBrowser_DocumentComplete);

void webBrowser_DocumentComplete(object pDisp, ref object URL)
mshtml.IHTMLDocument2 document =
mshtml.IHTMLWindow2 window = document.parentWindow;

//window.onscroll =
// new mshtml.HTMLWindowEvents_onscrollEventHandler(
// this.webBrowserWindow_onscroll);
window.onscroll =
new mshtml.HTMLWindowEvents2_onscrollEventHandler(
catch (Exception ex)

private void webBrowserWindow_onscroll()
private void webBrowserWindow_onscroll(mshtml.IHTMLEventObj pEvtObj)

any idea on what I'm doing wrong?

Aug 7 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.