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.on scroll property is the way to gohttp://msdn.microsoft.com/workshop/b...2/onscroll.asp
http://msdn.microsoft.com/workshop/a...s/onscroll.asp
another possibility seems to exist with IHTMLElement2.o nscroll using
the document body, but this does not solve the problem.
the following code snippet compiles but when executed it always throws
a System.NotImple mentedException
this is the stack trace:
in mshtml.HTMLWind ow2Class.IHTMLW indow2_set_onsc roll(Object p)
this is the code:
-------
//WebBrowser is a valid instance of SHDocVw.WebBrow serClass
this.WebBrowser .DocumentComple te += new
DWebBrowserEven ts2_DocumentCom pleteEventHandl er(webBrowser_D ocumentComplete );
void webBrowser_Docu mentComplete(ob ject pDisp, ref object URL)
{
mshtml.IHTMLDoc ument2 document =
(mshtml.IHTMLDo cument2)this.We bBrowser.Docume nt;
mshtml.IHTMLWin dow2 window = document.parent Window;
try
{
//window.onscroll =
// new mshtml.HTMLWind owEvents_onscro llEventHandler(
// this.webBrowser Window_onscroll );
window.onscroll =
new mshtml.HTMLWind owEvents2_onscr ollEventHandler (
this.webBrowser Window_onscroll );
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString()) ;
}
}
private void webBrowserWindo w_onscroll()
{
MessageBox.Show ("scroll");
}
private void webBrowserWindo w_onscroll(msht ml.IHTMLEventOb j pEvtObj)
{
MessageBox.Show ("scroll2");
}
------
any idea on what I'm doing wrong?
thanks
Claudio