按照说明这个函数返回其父窗口对象,但是我在实际使用中却发现不对额。建了一个基于对话框的程序,主窗口(即主对话框)创建一个非模态对话框1,该非模态对话框1又创建一个非模态对话框2。我在非模态对话框2中调用GetParent(),按说明应该返回非模态对话框1指针,但是我调试发现其返回的是主窗口(即主对话框对象),又尝试调用::GetParent(m_hWnd),仍然返回主窗口句柄。
如果直接在非模态对话框2中使用m_pParentWnd,该指针就是正确的非模态对话框1.求解释额~
对话框1是在主对话框中创建的,对话框2是在对话框1创建的,创建时都传入this。
如果直接在非模态对话框2中使用m_pParentWnd,该指针就是正确的非模态对话框1.求解释额~
对话框1是在主对话框中创建的,对话框2是在对话框1创建的,创建时都传入this。
解决方案 »
- 一个全局hook钩子,用于键盘监控,却始终无法拦截
- 关于单文档多框架的问题
- 打算用vc和sql做个数据库方面的小程序,但是遇到问题了,请教高手
- 求《winsock 2网络编程使用教程》配套光盘,100分奉上,不胜感谢!!
- 关于串口编程的问题,急!急!
- 网络监控之自动发现新加入的机器
- 象WORD中的打印页面设置对话框怎样调用, (急大侠救命!!!)
- 在客户端,如何恢复服务务器的备份过的SQL SERVER的数据?
- vc6中如果使用hash_map?
- 如何判断鼠标在移至一个CStatic上时响应某一事件?
- 用串口跟下面多台机器通讯应该怎么设计?
- 使用CXTPChartControl应包含哪些头文件
CWnd* GetParent( ) const;Return ValueIdentifies the parent window if the member function is successful. Otherwise, the value is NULL, which indicates an error or no parent window. The returned pointer may be temporary and should not be stored for later use.ResCall this function to get a pointer to a child window’s parent window (if any). The GetParent function returns a pointer the immediate parent. In contrast, the GetParentOwner function returns a pointer to the most immediate parent or owner window that is not a child window (does not have the WS_CHILD style). If you have a child window within a child window GetParent and GetParentOwner return different results.