一个很是奇怪的问题关于多视的(急急!!!!)
我做了一个多视的单文档程序,通过下列函数改变视:
BOOL CTreePage::ChangeView(CRuntimeClass *pNewViewClass)
{
CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
CView* pOldActiveView = pMainWnd->GetActiveView();
if (pOldActiveView->IsKindOf(pNewViewClass))
return TRUE;
::SetWindowLong(pOldActiveView->m_hWnd, GWL_ID, 0);
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = pOldActiveView->GetDocument();
CView* pNewView = STATIC_DOWNCAST(CView, pMainWnd->CreateView(&context));
if (pNewView != NULL)
{
// the new view is there, but invisible and not active...
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
pMainWnd->SetActiveView(pNewView);
pMainWnd->RecalcLayout();
// destroy the old view...
pOldActiveView->DestroyWindow();
return TRUE;
}
return FALSE;
}
我加入新的视(由CFormView派生)是可以实现的,现在我想将原来的视显示调用
ChangeView(RUNTIME_CLASS(COldView));//COldView是原来的视图也是从CFormView派生出现了问题:
我将OldView.h #include 后出现:
在这行:COldView* GetDocument();
有3个错误:
error C2143: syntax error : missing ';' before '*'
error C2501: 'CCAN_232Doc' : missing storage-class or type specifiers
error C2501: 'GetDocument' : missing storage-class or type specifiers
为什么请指教!!!!