必须是CView窗口。由于CView的构造函数是protected的,所以不能直接create.我用CView* pView = (CView *)(RUNTIME_CLASS(CView)->CreateObject());
pView->ShowWindow(SW_SHOW);
还是不行
求高人帮满

解决方案 »

  1.   

    重载cview 自己写个public的 create 调用 cview的那个protect的create
      

  2.   

    void CExDlg::OnButton1() 
    {
    CCreateContext pContext;
    if(pMainFrm==NULL)
    {
    pMainFrm = new CMainFrame;
    pContext.m_pCurrentDoc = NULL;
    pContext.m_pCurrentFrame = pMainFrm;
    pContext.m_pNewViewClass = RUNTIME_CLASS(CYourView);
    pContext.m_pNewDocTemplate = NULL; if(pMainFrm->Create(NULL, _T("MyView"), WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault,
    NULL, NULL, 0, &pContext))
    {
    pMainFrm->ShowWindow(TRUE);
    }
    }
    }
      

  3.   

    CCreateContext pContext;
    if(pMainFrm==NULL)
    {
    pMainFrm = new CMainFrame;
    pContext.m_pCurrentDoc = NULL;
    pContext.m_pCurrentFrame = pMainFrm;
    pContext.m_pNewViewClass = RUNTIME_CLASS(CYourView);
    pContext.m_pNewDocTemplate = NULL;if(pMainFrm->Create(NULL, _T("MyView"), WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault,
    NULL, NULL, 0, &pContext))
    {
    pMainFrm->ShowWindow(TRUE);
    }