I'm trying to make an MDI application, but my code to create the client window keeps failing. GetLastError() returns 1406 (Cannot create a top level child window). As far as I can tell, I'm doing exactly what The Forger does to create the client window (and the only difference between that and MSDN is using CreateWindowEx instead of CreateWindow):
Code:
CLIENTCREATESTRUCT ccs;
// Retrieve the handle to the window menu and assign the
// first child window identifier.
ccs.hWindowMenu = GetSubMenu(GetMenu(m_hwnd), IDX_MDIMENU);
ccs.idFirstChild = 0;
// Create the MDI client window.
m_hwndMDIClient = CreateWindowEx(WS_EX_CLIENTEDGE, "mdiclient", NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
m_hwnd, (HMENU)IDC_MAIN_MDI, GetModuleHandle(NULL), (LPVOID)&ccs);
if(!m_hwndMDIClient)
{
char temp[50];
MessageBox(NULL,"Could not create MDI Client window!",itoa(GetLastError(),temp,10),MB_OK);
return NULL;
}
I'm obviously doing something wrong, but I have no idea how I should change it