【发布时间】:2010-10-27 19:47:40
【问题描述】:
在我的原生 Windows 移动应用程序中,我有一个创建对话框的窗口。假设我的窗口句柄是hMainWnd。
我使用DialogBoxParam() 创建对话框并传入hMainWnd 作为对话框的父级:
DialogBoxParam(_,_,hMainWnd,_,_);
假设对话框的句柄是hDlgWnd。在对话框中,GetParent() 按预期返回 hMainWnd:
//We're inside the dialog created above
HWND hParent = GetParent(hDlgWnd); //hParent == hMainWnd
奇怪的是,调用GetWindow() 来查找hMainWnd 的子代会返回NULL,表示它没有子代。我希望该函数返回hDlgWnd
//We're inside the main window
HWND hChild = GetWindow(hMainWnd, GW_CHILD); //hChild == NULL
父母不认识自己的孩子,孩子怎么知道自己的父母?
【问题讨论】:
标签: c++ windows windows-mobile