最好能有源程序,发到
谢谢

解决方案 »

  1.   

    处理OnNewWindow()/OnNewWindow3()等事件
      

  2.   

    重写
    OnNewWindow()函数另外,CHtmlView 的话也可以: CHtmlView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel)
      

  3.   

    SDI或是MDI里的CHtmlView处理范例 void CYourView::OnNewWindow2(LPDISPATCH FAR* ppDisp,
                                  BOOL FAR* 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);    CYourView* pWBVw = (CYourView*)pNewFrame->GetActiveView();
        ASSERT(pWBVw);    pWBVw->m_webBrowser.SetRegisterAsBrowser(TRUE);    *ppDisp = pWBVw->m_webBrowser.GetApplication();
     }
      

  4.   

    void CYourView::OnNewWindow2(LPDISPATCH FAR* ppDisp,BOOL FAR* Cancel)
     {    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*)GetParentFrame());
        ASSERT(pNewFrame);    // Activate the frame and set its active view
        pDocTemplate->InitialUpdateFrame(pNewFrame, NULL);    CYourView* pWBVw = (CYourView*)pNewFrame->GetActiveView();
        ASSERT(pWBVw);    pWBVw->m_webBrowser.SetRegisterAsBrowser(TRUE);    *ppDisp = pWBVw->m_webBrowser.GetApplication();
     }