IE编程:多框架时,BeforeNavigate2中设置Cancel=true后,无法触发DocumentComplete事件
BHO编程, 当页面有iframe时,我在BeforeNavigate2中设置Cancel=true后,IE下面的状态条一直都是没有完成的状态,DocumentComplete事件无法触发,不知道该如何解决。
下面是我的代码
public override void SetSite(object pUnkSite)
{
base.SetSite(pUnkSite);
if (Explorer != null)
{
object guid = "E17F7F3B-AF3B-4b73-9D5D-CD11050626D9 ";
object show = true;
object size = 0;
Explorer.ShowBrowserBar(ref guid, ref show, ref size);
Explorer.BeforeNavigate2 += new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(Explorer_BeforeNavigate2);
Explorer.DocumentComplete += new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(Explorer_DocumentComplete);
}
else
{
Explorer.BeforeNavigate2 -= new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(Explorer_BeforeNavigate2);
Explorer.DocumentComplete -= new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(Explorer_DocumentComplete);
}
}
void Explorer_BeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel)
{
if (URL.ToString() != Explorer.LocationURL) // 是框架页面
{
IWebBrowser2 wb2 = pDisp as IWebBrowser2;
wb2.Stop();
Cancel = true;
}
}
void Explorer_DocumentComplete(object pDisp, ref object URL)
{
if (URL.ToString() == Explorer.LocationURL) // 是框架页面
{
MessageBox.Show(URL.ToString());
}
}
------解决方案--------------------这个问题没有碰到过哦,不懂,帮顶下,迫切想知道答案
------解决方案--------------------什么是BHO编程
------解决方案--------------------http://blog.csdn.net/vcmute/archive/2005/10/31/520080.aspx
------解决方案--------------------不懂
------解决方案--------------------看看这里有没有
http://www.vckbase.com/document/listdoc.asp?mclsid=17&sclsid=1711