重载OnNewWindow2函数,把以下代码的CMfcieView换成你的htmlview类就可以了。
void CMfcieView::OnNewWindow2( LPDISPATCH* ppDisp, BOOL* Cancel ) { // Get a pointer to the application object CWinApp* pApp = AfxGetApp(); // Get the correct document template CDocTemplate* pDocTemplate; POSITION pos = pApp-> GetFirstDocTemplatePosition(); pDocTemplate = pApp-> GetNextDocTemplate(pos); ASSERT(pDocTemplate); // Create the new frame CFrameWnd* pNewFrame = pDocTemplate-> CreateNewFrame(GetDocument(), (CFrameWnd*)AfxGetMainWnd()); ASSERT(pNewFrame); // Activate the frame and set its active view pDocTemplate-> InitialUpdateFrame(pNewFrame, NULL); CMfcieView* pWBVw = (CMfcieView*)pNewFrame-> GetActiveView(); ASSERT(pWBVw); pWBVw-> SetRegisterAsBrowser(TRUE); *ppDisp = pWBVw-> GetApplication(); } 添加一个类如MyHtmlView,基予CHtmlView,再添加虚拟函数virtual void OnNewWindow2( LPDISPATCH* ppDisp, BOOL* Cancel );或virtual void OnStatusTextChange( LPCTSTR lpszText );
例: void MyHtmlView::OnStatusTextChange( LPCTSTR lpszText ) { //处理lpszText,只纪录,http://,ftp://,mailto:等开头的字串; CHtmlView::OnStatusTextChange( LPCTSTR lpszText );//处理原来的函数 } |
|