Closed GoogleCodeExporter closed 8 years ago
Aha, the problem may have had to do with another change I made. This is a bit
tricky
though because the LoadHtmlIntoBrowser() method actually results in more events
being
fired, including another DocumentComplete event, so I had to be sure to set a
flag in
order to avoid infinite looping.
Original comment by murray.l...@gmail.com
on 30 Aug 2007 at 2:31
The document object is not available until the very first time webbrower
becomes
visible. This is by design and has nothing to do with this control.
Here are two possible solutions:
Use LoadHtmlIntoBrowser in Shown event which fires when the form is shown for
the
first time.
or
Subscribe to HTMLWindowEvents2.OnLoad event which fires immediately after the
browser loads the object.
//In form load, setup the event:
int[] dispids = { (int)HTMLEventDispIds.ID_ONLOAD };
m_CurWB.ActivateHTMLEvents(HTMLEventType.HTMLWindowEvent, dispids);
//Subscribe to HTMLEvent
m_CurWB.HTMLEvent += new csExWB.HTMLEventHandler(m_CurWB_HTMLEvent);
//Handle the event
void m_CurWB_HTMLEvent(object sender, csExWB.HTMLEventArgs e)
{
//Window events are not cancellable
if (e.m_EventType == HTMLEventType.HTMLWindowEvent)
{
if (e.m_EventDispId == HTMLEventDispIds.ID_ONLOAD)
{
csExWB.cEXWB pWB = (csExWB.cEXWB)sender;
//Start processing
}
}
}
MH
Original comment by mehr...@gmail.com
on 30 Aug 2007 at 11:19
Original issue reported on code.google.com by
murray.l...@gmail.com
on 30 Aug 2007 at 1:54