社区
界面
帖子详情
在CMainFrame 中定义一个成员,如何在CDocment类中访问它?
HighTech
2003-10-15 01:59:32
如题
...全文
67
2
打赏
收藏
在CMainFrame 中定义一个成员,如何在CDocment类中访问它?
如题
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
flyelf
2003-10-15
打赏
举报
回复
也可以使用(CMainFrame*)AfxGetMainWnd()得到CMainframe的指针
nalo
2003-10-15
打赏
举报
回复
CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
访问
应用程序的其它类
访问
应用程序的其它类(可能有些错误的地方)
获得CWinApp:
-在C
MainFrame
,CChildFrame,CDocument,CView
中
直接调用AfxGetApp()或用theApp
-在其它类
中
只能用AfxGetApp()
获得C
MainFrame
:
-在CMinApp
中
用AfxGetMainWnd()或者m_pMainWnd
-在CChildFrame
中
可用GetParentFrame()
-在其它类
中
用AfxG
获得MFC窗口其它类指针的方法
访问
应用程序的其它类,本文转自其他博客获得CWinApp:-在C
MainFrame
,CChildFrame,CDocument,CView
中
直接调用AfxGetApp()或用theApp-在其它类
中
只能用AfxGetApp()获得C
MainFrame
:-在CMinApp
中
用AfxGetMainWnd()或者m_pMainWnd
C++/MFC——获得MFC窗口其它类指针的方法
获得CWinApp: -在C
MainFrame
,CChildFrame,CDocument,CView
中
直接调用AfxGetApp()或用theApp -在其它类
中
只能用AfxGetApp()获得C
MainFrame
: -在CMinApp
中
用AfxGetMainWnd()或者m_pMainWnd -在CChildFrame
中
可用GetParentFrame() -在其它类
中
用AfxG
VC
中
如何
访问
各个类
访问
应用程序的其它类 获得CWinApp: -在C
MainFrame
,CChildFrame,CDocument,CView
中
直接调用AfxGetApp()或用theApp -在其它类
中
只能用AfxGetApp() 获得C
MainFrame
: -在CMinApp
中
用AfxGetMainWnd()或者m_pMainWnd -在CChildFrame
中
可用GetParentFrame() -在其它类
【C++】引用MFC指针的获取
引用MFC指针的获取(转载) 1、获取应用程序指针 CMyApp* pApp=(CMyApp*)AfxGetApp(); 2、获取主框架指针 CWinApp
中
的公有
成员
变量 m_pMainWnd 就是主框架的指针 C
MainFrame
* p
MainFrame
= (C
MainFrame
*)(AfxGetApp()->m_pMainWnd); 或者 CMainFr
界面
15,980
社区成员
115,867
社区内容
发帖
与我相关
我的任务
界面
VC/MFC 界面
复制链接
扫一扫
分享
社区描述
VC/MFC 界面
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章