有时提示功能并不能及时生效,而需要你重新编译后才行.
所以提示框里没有出现那个函数并不能说明不能调用它...通过框架取视的方法因SDI或MDI略有不同,这个问题在以前的贴子中多次出现过.对于MDI程序如下:
CMDIFrameWnd *pFrame = 
             (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = 
             (CMDIChildWnd *) pFrame->GetActiveFrame();
// or CMDIChildWnd *pChild = pFrame->MDIGetActive();// Get the active view attached to the active MDI child
// window.
CMyView *pView = (CMyView *) pChild->GetActiveView();如果是SDI程序直接使用GetActiveView即可.

解决方案 »

  1.   

    我一般是在Frame类中定义一个view的成员函数(m_pView),然后通过如下步骤:
           CWinApp *app = AfxGetApp();
           CMainFrame* pframe = (CMainFrame*)app->m_pMainWnd;
           ASSERT(pframe);
           pframe->m_pview->OnViewData();
    应该可以的。。
      

  2.   

    删除NCB文件,重新编译,提示就会有了
      

  3.   

    to joke100:这样做会告诉我 CXXXView 没有定义,而如果我在CMainFrame中include XXXView.h 的话,会出现更多的错误,曾经有人告诉我说框架类内不能包含视类,不知道这个怎么解决?
      

  4.   

    不要在框架的头文件中包含视的头文件.
    可以在框架的cpp文件中包含视的头文件.我的程序就是这么做的喔.
      

  5.   

    奇怪,我在MainFrame.cpp里面include 了 DesignView.h但是编译过后还是提示我error C2065: 'CDesignView' : undeclared identifier
      

  6.   


    你没在框架的头文件中调用视的东西吧,有的话全搬到CPP中来
      

  7.   

    // MainFrm.cpp : implementation of the CMainFrame class
    //#include "DesignView.h"
    #include "stdafx.h"
    #include "Design.h"#include "MainFrm.h"````````````````````````````````````````````````````
    //MainFrm.h
    #define TIMERNUM 100
    #include "NewClientWnd.h"
    #include "PswDlg.h"
    #include "RuKuInint.h"
    #include "DBAction.h"
    #include "ChangePswDlg.h"
    #include "SearchDlg.h"
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    本来没有问题,但在MainFrm.cpp里加上
    CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
    CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
    CDesignView *pView = (CDesignView *) pChild->GetActiveView();
    pView->OnViewData();
    就出问题。
    错误提示:
    D:\mywork\毕业设计\Design\MainFrm.cpp(533) : error C2065: 'CDesignView' : undeclared identifier
    D:\mywork\毕业设计\Design\MainFrm.cpp(533) : error C2065: 'pView' : undeclared identifier
    D:\mywork\毕业设计\Design\MainFrm.cpp(533) : error C2059: syntax error : ')'
    D:\mywork\毕业设计\Design\MainFrm.cpp(534) : error C2227: left of '->OnViewData' must point to class/struct/union不是拼写错误,我都是Ctrl-C、Ctrl-V来的。
      

  8.   

    #include "DesignView.h"
    #include "stdafx.h"
    的顺序倒过来,"stdafx.h"应该是第一个被包含的文件.你的程序是多文档界面吧?
      

  9.   

    倒过来又变成11个错误了。D:\mywork\毕业设计\Design\RuKuInint.h(36) : error C2065: 'IDD_RUKU_DIALOG' : undeclared identifier
    D:\mywork\毕业设计\Design\RuKuInint.h(36) : error C2057: expected constant expression
    D:\mywork\毕业设计\Design\DesignView.h(22) : error C2143: syntax error : missing ';' before '*'
    D:\mywork\毕业设计\Design\DesignView.h(22) : error C2501: 'CDesignDoc' : missing storage-class or type specifiers
    D:\mywork\毕业设计\Design\DesignView.h(22) : error C2501: 'GetDocument' : missing storage-class or type specifiers
    D:\mywork\毕业设计\Design\DesignView.h(60) : error C2143: syntax error : missing ';' before '*'
    D:\mywork\毕业设计\Design\DesignView.h(60) : error C2433: 'CDesignDoc' : 'inline' not permitted on data declarations
    D:\mywork\毕业设计\Design\DesignView.h(60) : error C2501: 'CDesignDoc' : missing storage-class or type specifiers
    D:\mywork\毕业设计\Design\DesignView.h(61) : error C2501: 'GetDocument' : missing storage-class or type specifiers
    D:\mywork\毕业设计\Design\DesignView.h(61) : error C2059: syntax error : ')'
    D:\mywork\毕业设计\Design\MainFrm.cpp(534) : error C2248: 'OnViewData' : cannot access protected member declared in class 'CDesignView'
            D:\mywork\毕业设计\Design\DesignView.h(54) : see declaration of 'OnViewData'是MDI的如果方便的话,我的QQ :245134
      

  10.   

    把#include "DesignView.h"放到包含文件的最后面试一试.上面的错误表明包含的顺序有问题了.
    应该记住在头文件中尽量少的使用包含其他头文件的手法
      

  11.   

    在你的DesignView.h中又包含了RuKuInint.h等东西,这样做很不好呃,容易引起嵌套包含