出一道小题目: :)
解决方案 »
- 如何为CDockablePane内的选项切换添加函数
- MFC文件基本操作的写入问题
- MFC中怎样实现鼠标选中一段字符然后复制的功能
- 高手帮帮忙,高分了
- 文档试图窗口可以做成 模式的忙?
- 难题:如何用vc实现在win2k or xp 中防止修改系统时间???
- 我正在学习《VC++技术内幕》(清华)第四版中的COM部分,在看书过程中遇到一些问题,想寻找学过或正在学习此书的朋友请教、交流!
- csdn里的分,意义何在?
- 如何通过vc读取网页activex控件中内容或将信息写入到网页activex控件
- 帮我看看这是怎么了。
- mpeg文件的格式问题???
- [水园公务贴12.7-12.15]--请大家监督,回答一个新版CSDN的一个功能,不想得到可用分和信誉分吗?
与
CMainFrame* pMF=(CMainFrame*)AfxGetApp()->m_pMainWnd;
一样吗?大家来说说!
CMainFrame* pMF=(CMainFrame*)AfxGetMainWnd();
virtual CWnd * GetMainWnd( );Return ValueThis function returns a pointer to one of two types of windows. If your thread is part of an OLE server and has an object that is in-place active inside an active container, this function returns the CWinApp::m_pActiveWnd data member of the CWinThread object. If there is no object that is in-place active within a container or your application is not an OLE server, this function returns the m_pMainWnd data member of your thread object.
其实
GetMainWnd()
{
return m_pMainWnd;
}
其实
GetMainWnd()
{
return m_pMainWnd;
}
由此看来不同啊,只是在If there is no object that is in-place active within a container or your application is not an OLE server时是一样的!!
因为:
使用GetMainWnd(),那么返回的值是:
This function returns a pointer to one of two types
of windows.
表示有2种情况。情况一:
If your thread is part of an OLE server
and has an object that is in-place active inside an
active container, this function returns the
CWinApp::m_pActiveWnd data member of the CWinThread object. 我有一点不明白:
这个CWinApp::m_pActiveWnd怎么是data member of the CWinThread object?
CWinApp::m_pActiveWnd不是应该是data member of the CWinApp object。
虽然CWinThread也有CWinThread::m_pActiveWnd。
但“CWinApp::m_pActiveWnd data member of the CWinThread object”这句话
是不是有点不太合适呢?还是我理解有偏差?情况二:
If there is no object that is in-place active within
a container or your application is not an OLE server,
this function returns the m_pMainWnd data member of your thread object.可见2个还是有差别的。
virtual CWnd * GetMainWnd( );Return ValueThis function returns a pointer to one of two types of windows. If your thread is part of an OLE server and has an object that is in-place active inside an active container, this function returns the CWinApp::m_pActiveWnd data member of the CWinThread object. If there is no object that is in-place active within a container or your application is not an OLE server, this function returns the m_pMainWnd data member of your thread object
(还有人想混,照贴MSDN,我也有!)我要的是透彻些的理解!前面的几位高人,再给解释清楚些吧,谢谢