I've been debugging with my MDI app for one bug:
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?
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);
I'm stuck on this single issue for more than 20 hours. Please help if you can!