根据 http://blog.csdn.net/CometNet/article/details/5261192 此资料!在CHtmlView中可以完全实现,没有问题!但是在CDHtmlDialog中却怎么也不行!代码如下!高手帮忙看看! BEGIN_EVENTSINK_MAP(CXXxDlg, CDHtmlDialog) ON_EVENT(CXXxDlg, AFX_IDC_BROWSER, 259 /* DocumentComplete */,OnDocumentComplete, VTS_DISPATCH VTS_PVARIANT) END_EVENTSINK_MAP() //在ChtmlView继承类中代码于此基本差不多!是完全可以判断加载完成!但是在CDhtmlDialog中不行! void CXXxDlg::OnDocumentComplete(LPDISPATCH lpDisp,VARIANT FAR* URL) { m_nCount++; // 这是我的一个类成员变量,用于计数 IUnknown* pUnk; LPDISPATCH lpWBDisp; HRESULT hr; CWnd* pCtrl = this->GetDlgItem(AFX_IDC_BROWSER); if(pCtrl) { pUnk = pCtrl->GetControlUnknown(); ASSERT(pUnk); hr = pUnk->QueryInterface(IID_IDispatch, (void**)&lpWBDisp); ASSERT(SUCCEEDED(hr)); if (lpDisp == lpWBDisp ) { CString strMessage; strMessage.Format(_T(“页面加载完成!:%d”), m_nCount); AfxMessageBox(strMessage); } lpWBDisp->Release(); } } |
>> 本文固定链接: http://www.vcgood.com/archives/3579