Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AxSHDocVw... IHTMLBodyElement.onload fire event?

0 views
Skip to first unread message

Andy Johnson

unread,
Jun 5, 2005, 4:34:03 PM6/5/05
to
Hi,

I"m trying to capture the body onload event to determine if one is running
when a website loads using mshtml in a win form... I'm writing in c# and
this is the code I have I just can't seem to get access to the onload event,
I have the pointer to the event I believe in the second line of code it is
body.onload, however I'm not sure how to fire this event since
mshtml.HTMLDocumentEvents2_Event doesn't have a onload event handler to
use... Is this possible? am I just using the wrong event object? The code
is below, thanks in advance.

inside DocumentComplete...

IHTMLDocument2 doc = (IHTMLDocument2)this.axWebBrowser1.Document;

IHTMLBodyElement body = doc.body;

mshtml.HTMLDocumentEvents2_Event iEvent;
iEvent = (mshtml.HTMLDocumentEvents2_Event) doc;

/*
iEvent doesn't have onload?
iEvent = (mshtml.HTMLDocumentEvents2_Event) doc;
iEvent.onactivate += new
mshtml.HTMLInputImageEvents_onactivateEventHandler(doLoad);
*/

Igor Tandetnik

unread,
Jun 5, 2005, 5:01:58 PM6/5/05
to
"Andy Johnson" <AndyJ...@discussions.microsoft.com> wrote in message
news:3CB084A2-DBF8-439A...@microsoft.com

> I"m trying to capture the body onload event
> I'm not sure
> how to fire this event since mshtml.HTMLDocumentEvents2_Event doesn't
> have a onload event handler to use

onload event is fired by window object (accessible as
document.parentWindow) via HTMLWindowEvents source interface.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Igor Tandetnik

unread,
Jun 9, 2005, 12:05:27 AM6/9/05
to
"Andy Johnson" <AndyJ...@discussions.microsoft.com> wrote in message
news:3B8EFB11-0B4B-424A...@microsoft.com
> Also, will I need to run this event in a seperate thread to determine
> if the onload of the body starts a new navigate2 call?

This question does not make any sense to me, sorry.

Igor Tandetnik

unread,
Jun 9, 2005, 12:04:56 AM6/9/05
to
"Andy Johnson" <AndyJ...@discussions.microsoft.com> wrote in message
news:CF48C7CB-D02B-48D8...@microsoft.com
> Works great thanks... one more question is there some way for me to
> tell if the page that is loading has an onload event?

window.onload != null

0 new messages