[RESOLVED] SendMessage fails with WM_MDICREATE
Hi all:
I've been debugging with my MDI app for one bug:
Code:
MDICREATESTRUCT mcs;
HWND hChild;
mcs.szTitle = L"[Untitled]";
mcs.szClass = MDI_CHILD_WND_NAME;
mcs.hOwner = GetModuleHandle(NULL);
mcs.x = mcs.cx = CW_USEDEFAULT;
mcs.y = mcs.cy = CW_USEDEFAULT;
mcs.style = MDIS_ALLCHILDSTYLES;
hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs);
if(hChild == NULL)
{
MessageBox(hMDIClient, L"Failed to create MDI Child", L"Error",
MB_ICONEXCLAMATION | MB_OK);
}
The MDI client window shows up correctly. I've also double checked hMDIClient is having the correct value, i.e. it is indeed the handle to the MDI client window. But why does it always fail to create MDI child window?
I'm stuck on this single issue for more than 20 hours. Please help if you can!
Thanks.
Re: SendMessage fails with WM_MDICREATE
You could try CreateMDIWindow and if it fails, call GetLastError() and look at the system error codes.
Re: SendMessage fails with WM_MDICREATE
Thanks for the reply.
I've got it sorted out. It was due to a silly mistake of mine in another place of the code.