一个很是奇怪的问题关于多视的(急急!!!!)

fengying2001 2003-09-13 06:01:02
我做了一个多视的单文档程序,通过下列函数改变视:
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
为什么请指教!!!!
...全文
25 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengying2001 2003-09-13
  • 打赏
  • 举报
回复
算了,结了吧!!!
fengying2001 2003-09-13
  • 打赏
  • 举报
回复
上述代码用到了吗?那一句呀?
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = pOldActiveView->GetDocument();
CView* pNewView = STATIC_DOWNCAST(CView, pMainWnd->CreateView(&context));
是吗??怎么用的》?
HongHuer 2003-09-13
  • 打赏
  • 举报
回复
都用到了文档类吗?


只有用到了文档类才需要包含 .h啊。
fengying2001 2003-09-13
  • 打赏
  • 举报
回复
那会是什么原因呢?用APPWIZARD生成的代码中在视类的.H中都没有保含文档类呀?
HongHuer 2003-09-13
  • 打赏
  • 举报
回复
我认为没有。
fengying2001 2003-09-13
  • 打赏
  • 举报
回复
但是如果不加入上述代码就没有任何问题呀!和RUNTIME_CLASS有关系吗?

HongHuer 2003-09-13
  • 打赏
  • 举报
回复
没有头文件,CCAN_232Doc类没有申明
fengying2001 2003-09-13
  • 打赏
  • 举报
回复
能告诉我是为什么吗?立刻结贴!!
kingeboy 2003-09-13
  • 打赏
  • 举报
回复
#inlcude "CAN_232Doc.h"在试试
搬不搬砖 2003-09-13
  • 打赏
  • 举报
回复
up
HongHuer 2003-09-13
  • 打赏
  • 举报
回复
#inlcude "'CAN_232Doc.h "
  • 打赏
  • 举报
回复
#include "***Doc.h"

16,466

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧