GetWindowRect (AfxGetMainWnd()->GetSafeHwnd (),&ClientRect);是对的
GetWindowRect (AfxGetMainWnd()->m_hWnd,&ClientRect);是错的呢?第一个参数都是CWnd类型的参数啊,也都是获得句柄啊
我实在是想不明白,请各位解释一下?
GetWindowRect (AfxGetMainWnd()->m_hWnd,&ClientRect);是错的呢?第一个参数都是CWnd类型的参数啊,也都是获得句柄啊
我实在是想不明白,请各位解释一下?
解决方案 »
- 如何POST数据到PHP网址
- 如何重载CSplitterWnd类啊?
- MFC中如何利用Excel ChartWizard生成图表?(在线等)
- 在CMainFrame::OnCreate()执行中能否访问文档类的数据?
- 自学计算机课程的天堂-
- 请问对一个对话筐来说create和OnCreate函数有什么异同?
- 使用Winsock Control出现如下错误:Socket is non-blocking and the specified operation will block
- 继续提问:DLL中的难题!(导出类与消息映射)
- Sybase ASE 12.5
- 请问在VC下能否调用标准C的函数,若能,如何调?急急!!!
- 请问无线按钮分组
- 3个小问题,请教每个10分
关于GetSafeHwnd与m_hWnd的区别,见
http://expert.csdn.net/Expert/topic/2172/2172590.xml?temp=.6769678
HWND GetSafeHwnd( ) const;Return Value
Returns the window handle for a window. Returns NULL if the CWnd is not attached to a window or if it is used with a NULL CWnd pointer.
GetWindowRect (m_hWnd,&ClientRect);但我试过,是可以通过的,也达到了我的要求
还有看调用的时机
如果恰好在CXXXApp::InitInstance()
{
...
m_pMainWnd被初始化之前调用,则运行时出错,因为AfxGetMainFrame()得到的是空指针.
}