When using AXWebroswer in my Windows-Forms app it is impossible to catch all
events
of the displayed html-document.
It only works with a few events. See the following example:
//get the IHTMLDocument2
mshtml.IHTMLDocument2 htmlDoc = axWebBrowser1.Document as
mshtml.IHTMLDocument2;
if ( htmlDoc != null )
{
// get the input item elemnet
HTMLInputTextElement input = (HTMLInputTextElement)
htmlDoc .all.item("id1", null);
if ( input != null )
{
// register eventhandler
((HTMLInputTextElementEvents2_Event)input).onclick += new
HTMLInputTextElementEvents2_onclickEventHandler( this.Text_EventHandler );
}
}
private bool HTML_EventHandler(mshtml.IHTMLEventObj e)
{
MessageBox.Show("Alert from the html:text event" );
return true;
}
It is possible to register the appropriate event handler, but it is never
called !!!
But it works when i register an event handler for the click-event, see the
following example.
// register eventhandler
((HTMLInputTextElementEvents2_Event)input).onchange += new
HTMLInputTextElementEvents2_onchangeEventHandler( this.Text_EventHandler );
Is there a different and working approach to catch these events?