private System.Timers.Timer t = null;
WebBrowser webBrowse;
HTMLDocument document;
public void BHO_HelloWord()
{
t = new System.Timers.Timer(1000);
t.Elapsed += new System.Timers.ElapsedEventHandler(doit);
t.AutoReset = true;
t.Enabled = true;
t.Start();
}
private void doit(object sender, EventArgs e) ///记时器
{
MethodInvoker mi = new MethodInvoker(dw);
this.BeginInvoke(mi); /// 标记1
document = (HTMLDocument)webBrowse.Document;
string abc = document.body.innerHTML; ///标记2
}
public void OnDocumentComplete(object pDisp, ref object URL)
{
document = (HTMLDocument)webBrowse.Document;
string abc = document.body.innerHTML; ///标记3
}用C# 做 BHO的DLL
为什么,在DLL的类里不让用BeginInvoke委托?怎样解决? 标记1处
还有 在计时器里读取webBrowse的内容(标记2处)会提示错误,无法使用COM控件,不能读取,而在标记3处就正常.
WebBrowser webBrowse;
HTMLDocument document;
public void BHO_HelloWord()
{
t = new System.Timers.Timer(1000);
t.Elapsed += new System.Timers.ElapsedEventHandler(doit);
t.AutoReset = true;
t.Enabled = true;
t.Start();
}
private void doit(object sender, EventArgs e) ///记时器
{
MethodInvoker mi = new MethodInvoker(dw);
this.BeginInvoke(mi); /// 标记1
document = (HTMLDocument)webBrowse.Document;
string abc = document.body.innerHTML; ///标记2
}
public void OnDocumentComplete(object pDisp, ref object URL)
{
document = (HTMLDocument)webBrowse.Document;
string abc = document.body.innerHTML; ///标记3
}用C# 做 BHO的DLL
为什么,在DLL的类里不让用BeginInvoke委托?怎样解决? 标记1处
还有 在计时器里读取webBrowse的内容(标记2处)会提示错误,无法使用COM控件,不能读取,而在标记3处就正常.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货