Hi Williem,
I have been following this thread and made good use of it. I was also facing the same problem of unable to fire the onchange event of the Select element. That was quite much possible with the code you posted. Thanks.
I am facing one more problem. I am relying on the documentComplete event of the AXWebBrowser control to do much of much processing. Now this event fires before the javascript's body onload event has fired, and as a result, in the event handler for documentComplete , I am getting unexpected results. I thought of two ways to circumvent this:
1. Obviously, i would like to get the javascript's body onload event to be fired before documentComplete event of the AXWebBrowser control , but thats not possible. So I could move all my code to the javascript's body onload eventhandler (i could trap it in my C# code!!) and start processing from there. The code for this is:
IHTMLWindow2 f = (IHTMLWindow2)(htmldoc.parentWindow);
f.onload = this;
This will call the followinf function for every event:
[DispId(0)]
public void DefaultMethod()
{
HTMLWindow2 win = (HTMLWindow2)((HTMLDocument);
(wbActiveBrowser.wbWebBrowser.Document)).parentWindow;
Console.WriteLine("Object: " +
win.@event.srcElement + ", Type: " + win.@event.type);
}
But the issue is, due to this, the actual javascript functions that are there in the document, wont be fired. So we need to execute those functions too. I tried to refire the event by using this code:
IHTMLElement3 f = (IHTMLElement3)win;
object o = win.@event;
f.FireEvent("onload",ref o);
But i am not able to fire the onload event by this. Please help!!!
In essence, i need to setup a hook for the onload event. My C# code should be notified whenever this onload event is fired, and at the same time, the functions defined in javascript for the event, should be executed as well.
Thanks for reading this,
Hoping a reply ...
Mayank