CMainFrame添加两个成员,一个n_index(整型),一个m_rs(记录集)
CMainFrame类有一个成员变量n_index;(可是公有成员,也可是私有成员)
Cheadview类(也就是CmainFrame下的视图),如何获取n_index的值?在CPP文件里已经#include "mainfrm.h"
我用了(CMainFrame *)AfxGetApp()->GetMainWnd()->n_index.
会提示出错:error C2039: 'n_index' : is not a member of 'CWnd'取(CMainFrame *)AfxGetApp()->GetMainWnd();来调试,得到的地址就是mainframe的地址。其成员n_index的值未知。m_rs的地址,m_rs的成员n_age也可以查看到它的值。但是用(CMainFrame *)AfxGetApp()->GetMainWnd()->m_rs.
就会提示error C2039: 'n_rs' : is not a member of 'CWnd'求求大虾指点迷津
CMainFrame类有一个成员变量n_index;(可是公有成员,也可是私有成员)
Cheadview类(也就是CmainFrame下的视图),如何获取n_index的值?在CPP文件里已经#include "mainfrm.h"
我用了(CMainFrame *)AfxGetApp()->GetMainWnd()->n_index.
会提示出错:error C2039: 'n_index' : is not a member of 'CWnd'取(CMainFrame *)AfxGetApp()->GetMainWnd();来调试,得到的地址就是mainframe的地址。其成员n_index的值未知。m_rs的地址,m_rs的成员n_age也可以查看到它的值。但是用(CMainFrame *)AfxGetApp()->GetMainWnd()->m_rs.
就会提示error C2039: 'n_rs' : is not a member of 'CWnd'求求大虾指点迷津
pMain->n_index...
pMain->m_rs...
编译是不会出错了。
就是等到pmain->n_index的值是-842150451.无效值。
还是不行。
=>
((CMainFrame *)AfxGetApp()->GetMainWnd())->n_index
照办了。
为什么n_index还是无效值?
是不是n_index在定义出了问题?