GetParent() always returns NULL!!
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
This one is really driving me nuts! I am creating a dialog using the following code:
if (!::IsWindow(pPS->pDlg->m_hWnd)){ pPS->pDlg->Create(IDD_CFG_DLG, this); } HWND hwndParent = ::GetParent(pPS->pDlg->m_hWnd);
The creation happens after the OnInitDialog() of the main application window (a dialog) and everything seems to return success except for the GetParent() call which I am expecting to return my main dialog's m_hWnd. The IDD_CFG_DLG does have the "CHILD" style set and no border if that matters (I don't think it does). I have also tried forcing the parent by calling SetParent() but even though it returns no error, the result is the same - the parent of the created dialog is still NULL! What am I doing wrong here? Thanks, Dave