请问如何在对话框类里调用视图类的变量?
我想在自定义的对话框类里比如ClistBoxDlg调用视图类里的(public:CSeMapWnd m_MapWnd)m_MapWnd变量,如果我用下面的方法
ClistBoxDlg::ClistBoxDlg(CWnd* pParent /*=NULL*/)
: CDialog(ClistBoxDlg::IDD, pParent)//对话框类的构造函数
{
CMainFrame* pMainWnd=(CMainFrame*)((CCarNaviApp*)AfxGetApp())->m_pMainwnd;//获得视图类的指针
CCarNaviView* pDoc = (CCarNaviView*)pMainWnd->GetActiveView();}//指针类型转换
但是报错:carnaviview.h(22) : error C2143: syntax error : missing ';' before '*'
carnaviview.h(22) : error C2501: 'CCarNaviDoc' : missing storage-class or type specifiers
carnaviview.h(22) : error C2501: 'GetDocument' : missing storage-class or typespecifiers listboxdlg.cpp(25) : error C2039: 'm_pMainwnd' : is not a member of 'CCarNaviApp'
carnaviview.h 第22行的内容是public:CCarNaviDoc* GetDocument();
请问我这样的方法可以吗,如果不可以有什么其他的方法,如果可以,请问错在哪里了呢?