1.手动添加两个虚函数
virtual void DocumentComplete(LPDISPATCH pDisp, VARIANT* URL);
virtual void NavigateComplete2(LPDISPATCH pDisp, VARIANT* URL);
2.声明一个变量
LPDISPATCH m_lpDisp;//用于判断网页加载是否真正完毕
m_lpDisp = NULL;//构造函数中初始化
3.具体
void CXXX::DocumentComplete(LPDISPATCH pDisp,VARIANT* URL)
{
if(m_lpDisp &&(m_lpDisp == pDisp))//判断网页是否真正加载完毕,用于多Frame网页
{
//if the LPDISPATCH are same,that means it is the final DocumentComplete
AfxMessageBox("下载完毕");
m_lpDisp=NULL;//Reset glpDisp
}
}
//配合DocumentComplete,判断网页是否真正加载完毕,用于多Frame网页
void CXXX::NavigateComplete2(LPDISPATCH pDisp,VARIANT* URL)
{
//Check if glpDisp is NULL.If NULL,that means it is
//the top level NavigateComplete2. Save the LPDISPATCH
if(!m_lpDisp) m_lpDisp=pDisp;
}