I have created a modeless dialog as a main window, but the window procedure isn't being sent WM_INITDIALOG messages.
Here's what I've done.
- Created a dialog template using Visual Studio's resource editor, and set its class name to a custom class.
- Used WNDCLASSEX to register the class, window procedure, as well as some icons and brush etc.
- Used CreateDialog() with the last two parameters set to NULL, (Parent window, and window procedure).
- Created the message loop using IsDialogMessage(), TranslateMessage() and DispatchMessage();
- Returned DefDlgProc() in the window procedure as the default if no messages were processed.
I can't think of anything else significant. Everything works well except for not receiving WM_INITDIALOG messages. I've done it this way so the app minimises to the task bar, and I can have a menu if needed.
So my first question is, Have I done anything stupid?
Secondly, should I expect to receive WM_INITDIALOG messages using this system? And if not, what is a good way to initialise say a combobox with strings. (I've looked at things like WM_ACTIVATE, WM_ACTIVATEAPP etc, but nothing seems appropriate. And the combobox isn't created yet at WM_CREATE.) Thanks in advance.
I realised the answer shortly after posting. As mentioned in the comments above, it's a window procedure, not a dialog procedure, so I shouldn't have been trying to initialize child windows within the procedure.
So I initialized them outside the procedure, after creating the dialog box and before the message loop. All the dialog features are working as expected, but it's a main window that can have a menu and minimizes to the taskbar.