WM_CREATE not called?

1
2
3
4
5
6
7
8
case WM_CREATE:
{
   lP = MAKEIPADDRESS(127, 0, 0, 1);
   HWND ip = GetDlgItem(hDlg, IDC_IPADDRESS1);
   SendMessage(ip, IPM_SETADDRESS, 0, lP);
   OutputDebugString("Set the address...");
}
return TRUE;


This is the code in my DialogProc, but it never seems to get called(others work fine).
the string is not printed, so the block isn't even called...
If indeed you are in a DialogProc (the WndProc created by the Windows Dialog Engine) rather than a standard Window Procedure, you won't ever get the WM_CREATE message. I almost never use dialog procedures myself. I believe the message there you want is WM_INITIATE or something like that. Realize that with dialog procedures, the actual WndProc is internal to windows. That's why you aren't getting it in a DlgProc().
so what if I want to create secondary windows with CreateDialogParam()?

EDIT: oh and I looked up, it's WM_INITDIALOG message, it works now!
Last edited on
My advice would be to just do things right and set yourself up with a real WndProc() where you'll actually get WM_CREATE messages. If the app is to show other windows/dialogs/forms, whatever, register classes named appropriately to their purpose. Then use CreateWindowEx() for them and their Window Procedures. But you can call CreateDialogParam() if you want and keep the troubles coming. That function, as well as DialogBox() (actually, a macro), does nothing but call CreateWindowEx() on your behalf, hide the Window Procedure within Windows, and give you a DialogProc and a host of difficulties down the line. As you can tell, I'm not a fan of the Windows Dialog Engine. But that's just me. Glad to here its working now.
Topic archived. No new replies allowed.