Hi James,
The mshtml Document object provides an COM event names onreadystatechange,
This event will be fired when there is an changed to the document object,
you may try
handling this event and check the readystate in the event handler , the
readystate should be "completed"
after the document is loaded.
You may handle COM event like this way, also you may take a look at this
link,
http://www.itwriting.com/htmleditor/index.php
Tim Anderson had implemented a HTMLEditor using the mshtml component,
maybe
you will get some idea from it.
Thanks, if you have any questions on this issue, please reply to group to
let us know.
<code>
private void button1_Click(object sender, System.EventArgs e)
{
object opt = Type.Missing;
object url = "
http://www.google.com";
axWebBrowser1.Navigate2 (ref url,ref opt,ref opt,ref opt,ref opt);
}
private Int32 cookie;
private UCOMIConnectionPoint pConPt;
private void axWebBrowser1_NavigateComplete2(object sender,
AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
{
if (cookie == 0)
{
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
UCOMIConnectionPointContainer pConPtCon =
(UCOMIConnectionPointContainer)doc;
Guid guid = typeof(mshtml.HTMLDocumentEvents2).GUID;
pConPtCon.FindConnectionPoint(ref guid, out pConPt);
IEHTMLDocumentEvents d = new IEHTMLDocumentEvents();
pConPt.Advise(d, out cookie);
MessageBox.Show(cookie.ToString());
}
}
public class IEHTMLDocumentEvents : mshtml.HTMLDocumentEvents2
{
public void onactivate(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onafterupdate(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onbeforeactivate(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public bool onbeforedeactivate(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onbeforeeditfocus(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onbeforeupdate(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void oncellchange(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onclick(mshtml.IHTMLEventObj pEvtObj)
{
MessageBox.Show("click");
return true;
}
public bool onstop(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public bool onselectstart(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onselectionchange(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onrowsinserted(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onrowsdelete(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onrowexit(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onrowenter(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onreadystatechange(mshtml.IHTMLEventObj pEvtObj)
{
MessageBox.Show("readyStateChange");
}
public void onpropertychange(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onmousewheel(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onmouseup(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onmouseover(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onmouseout(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onmousemove(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool oncontextmenu(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public bool oncontrolselect(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void ondataavailable(mshtml.IHTMLEventObj pEvtObj)
{
}
public void ondatasetchanged(mshtml.IHTMLEventObj pEvtObj)
{
}
public void ondatasetcomplete(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool ondblclick(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void ondeactivate(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool ondragstart(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public bool onerrorupdate(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onfocusin(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onfocusout(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onhelp(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onkeydown(mshtml.IHTMLEventObj pEvtObj)
{
}
public bool onkeypress(mshtml.IHTMLEventObj pEvtObj)
{
return true;
}
public void onkeyup(mshtml.IHTMLEventObj pEvtObj)
{
}
public void onmousedown(mshtml.IHTMLEventObj pEvtObj)
{
}
}
</code>
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed
before
sending.