我定义了一个无模式话框,该对话框中有含有组合框,ID为ID_COMBO_LINESTYLE,然后生成了一个对话框类,这个对话框类的名称是:CLineStyleDlg,我在该类的CLineStyleDlg::OnSelchangeComboLinestyle() 函数中添加了获取框架窗口指针和视图窗口指针的代码,具体如下:
     CMainFrame * pframe=(CMainFrame *)GetParent();//获取框架窗口指针
     CTestdlgView * pview=(CTestdlgView *)pframe->GetActiveView();
                                                    //获取视图指针
    而且我还在CLineStyleDlg类的实现文件中加了头文件:
     #include "MainFrm.h"
     #include "testdlgDoc.h"           //文档类的定义
     #include "testdlgView.h"          //视图类的定义
但是编译出错:
F:\wjw\vc++\testdlg\LineStyleDlg.cpp(90) :
          error C2065: 'CTestdlgView' :  undeclared identifier
F:\wjw\vc++\testdlg\LineStyleDlg.cpp(90) : 
          error C2065: 'pview' : undeclared identifier
F:\wjw\vc++\testdlg\LineStyleDlg.cpp(90) : error C2059: syntax error : ')'请各位高手指点,谢谢!

解决方案 »

  1.   

    你的问题出在系统不能识别类:CTestdlgView,而你的主窗口类没有问题,是正确的,你确认你输入的CTestdlgView拼写是正确的吗?注意大小写!!!
      

  2.   

    我认为你的错误出在大写的T上了,改为小写就解决了,你将:
    CTestdlgView * pview(CTestdlgView)pframe=GetActiveView();改为:
    CtestdlgView * pview(CtestdlgView)pframe=GetActiveView();
      

  3.   

    谢谢!
    但我的CTestdlgView是绝对没问题的,因为我是装了visual assist,而且我检查了很多遍。如果把T该为t,通不过visaul assist 的检查。
      

  4.   

    你把
    #include "testdlgView.h" 里的东西贴出来看看
      

  5.   

    CMainFrame * pframe=(CMainFrame *)GetParent();//获取框架窗口指针
         CTestdlgView * pview=(CTestdlgView *)pframe->GetActiveView();
    =================
    问题可能出在第一句话上,某个字符没有被识别,已经提示你)出错了。重新写一遍看看,要不用下边方法。我这样用是好用的
    void CTestDialog::OnButton1() 
    {
    // TODO: Add your control notification handler code here
    CMainFrame* pFrame=(CMainFrame*)AfxGetMainWnd();
    CTest2View* pView=(CTest2View*)pFrame->GetActiveView();}
      

  6.   

    提示不能识别'CTestdlgView' 类,,加头文件