想让窗口一加载就显示百度,但是崩溃了。编译可以通过
class CMyHtmlView : public CHtmlView
{
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow();
afx_msg int OnCreate(LPCREATESTRUCT);
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT,CPoint);
public:
CMyHtmlView view; DECLARE_MESSAGE_MAP()
};
int CMainWindow::OnCreate (LPCREATESTRUCT )
{
view.Navigate( L"http:\\\\www.baidu.com");
return 0;
}
CMainWindow::CMainWindow ()
{
CFrameWnd::Create(0,L"");
CRect r;
GetClientRect(r);
view.Create (L"CMyHtmlView",0, WS_CHILD | WS_VISIBLE, r,this,1);
}

解决方案 »

  1.   

    用向导生成的代码直接改就可以了void CHtmlView::OnInitialUpdate()
    {
    CHtmlView::OnInitialUpdate(); // TODO: This code navigates to a popular spot on the web.
    //  change the code to go where you'd like.
    // Navigate2(_T("http://www.microsoft.com/visualc/"),NULL,NULL);
    Navigate2(_T("http://www.baidu.com"),NULL,NULL);
    }不知道楼主为什么自己写代码搞
      

  2.   

    完整代码贴出来,你是自己模拟MFC的文档模板结构吧
      

  3.   


    不可能,你用VC6创建单文档窗体,选CHtmlView作为你的视图基类,再改下Navigate2地址就可以了。
      

  4.   

        CFrameWnd::Create(0,L"");
        CRect r;
        GetClientRect(r);
        view.Create (L"CMyHtmlView",0, WS_CHILD | WS_VISIBLE, r,this,1);
    把这些放 view.Navigate( L"http:\\\\www.baidu.com");上面试试
      

  5.   

    CFrameWnd::Create(0,L"");
        CRect r;
        GetClientRect(r);
        view.Create (L"CMyHtmlView",0, WS_CHILD | WS_VISIBLE, r,this,1);这段代码应该不可以在主窗口的构造函数里出现。
      

  6.   


    Team版 2008SP1一样没问题。不知道你是怎么做的。