- 注册时间
- 2011-3-10
- 最后登录
- 1970-1-1
该用户从未签到
|
********************************
<1>在view类中获得doc类的指针:
C**doc *doc=GetDocument();//view类有定义C**doc *GetDocument();
<2>在view类中获得MainFrame类的指针:(两种方法)
方法1:CMainFrame *mainframe=(CMainFrame *)AfxGetMainWnd();
//全局函数AfxGetMainWnd()返回的是CWnd *的指针,而CMainFrame类派生于CWnd
方法 2:CMainFrame *mainframe=(CMainFrame *) AfxGetApp()->m_pMainWnd;
//全局函数AfxGetApp()返回CWinApp的指针(),CWinApp类也有一个m_pMainWnd变量,继承于CWinThread类。
<3>在view类中获取app类的指针:
C**app *pp=(C**app *) AfxGetApp();
|
|