0
votes

I created a main dialog window with a child dialog window embedded. The child dialog is created using the style

DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_TABSTOP

Everything is good but GetDlgItem(hDlgMain, IDD_DLG_CHILD) doesn't work.

I found that GetDlgItem doesn't work with Dialog Template ID, it should use control ID.

What is the best way to get the handle of the child dialog in this case? (Do not use global or static variables to store child windows' handles).

1
Why are you using an IDD when you should be using an IDC to find the child back? - Hans Passant
Because there is no IDC for the child dialog, and I didn't realized that it required IDC rahter than IDD later - user565739

1 Answers

1
votes

When you create the child dialog, simply save the handle that's returned from the CreateDialogParam function.