我想在自己的程序里打开网页,而不是用IE打开
void   CMyHtmlView::OnNewWindow2(LPDISPATCH*   ppDisp,   BOOL*   Cancel)   

      //   Get   a   pointer   to   the   application   object. 
      CWinApp*   pApp   =   AfxGetApp();       //   Get   the   correct   document   template. 
      POSITION   pos   =   pApp-> GetFirstDocTemplatePosition(); 
      CDocTemplate*   pDocTemplate   =   pApp-> GetNextDocTemplate(   pos   );       //   Create   a   new   frame. 
      CFrameWnd*   pFrame   =   pDocTemplate-> CreateNewFrame( 
                                                                                    GetDocument(), 
                                                                                    (CFrameWnd*)AfxGetMainWnd()   );       //   Activate   the   frame. 
      pDocTemplate-> InitialUpdateFrame(   pFrame,   NULL   ); 
      CMyHtmlView*   pView   =   (CMyHtmlView*)pFrame-> GetActiveView();       //   Pass   pointer   of   WebBrowser   object. 
      pView-> SetRegisterAsBrowser(   TRUE   ); 
      *ppDisp   =   pView-> GetApplication();       
} 执行到     pView-> SetRegisterAsBrowser(   TRUE   ); 
      *ppDisp   =   pView-> GetApplication();   就出错了,内存不可读

解决方案 »

  1.   


     CWebView *pView = (CWebView*)pFrame->GetActiveView();  
      LPCSTR vUrl2= "http://www.baidu.com";
      pView->Navigate(vUrl2, NULL, NULL,NULL,NULL,NULL);
      

  2.   

    up~~~~
    CHtmlView多文档怎么在新窗口打开网页????
      

  3.   

    void CCsdnAutorView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel)
    {
    ASSERT(ppDisp);
      if (!ppDisp)
      return;
      CWinApp* pApp = AfxGetApp();
      CDocTemplate* pDocTemplate;
      POSITION pos = pApp->GetFirstDocTemplatePosition();
      pDocTemplate = pApp->GetNextDocTemplate(pos);
      ASSERT(pDocTemplate);
      CFrameWnd* pNewFrame = pDocTemplate->CreateNewFrame(GetDocument(),(CFrameWnd*)AfxGetMainWnd());
      ASSERT(pNewFrame);
      pDocTemplate->InitialUpdateFrame(pNewFrame, GetDocument());
      CCsdnAutorView* pWbView = (CCsdnAutorView*)pNewFrame->GetActiveView();
      ASSERT(pWbView);
      pWbView->SetRegisterAsBrowser(TRUE);
      *ppDisp = pWbView->GetApplication();
    CHtmlView::OnNewWindow2(ppDisp, Cancel);
    }测试通过,没有问题啊
      

  4.   

    左侧TreeView去掉就可以了,创建的时候使用资源管理器样式