I am trying to make one main window and inside that one I want to have one window that renders OpenGL stuff and another one that is an edit control. So I made this:
Code:
const char wndclass[] = "OpenGL Program";
const char oglclass[] = "OpenGL Renderer";
WNDPROC oldconproc;
HWND window;

int WINAPI WinMain (HINSTANCE inst, HINSTANCE pinst, char* args, int show)
{
	WNDCLASSEX wc;
	WNDCLASSEX oc;
	MSG msg;

	ZeroMemory(&wc, sizeof(wc));
	wc.cbSize        = sizeof(wc);
	wc.lpfnWndProc   = wndproc;
	wc.hInstance     = inst;
	wc.hbrBackground = COLOR_WINDOW;
	wc.lpszClassName = wndclass;

	ZeroMemory(&oc, sizeof(oc));
	oc.cbSize        = sizeof(oc);
	oc.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	oc.lpfnWndProc   = oglproc;
	oc.hInstance     = inst;
	oc.hbrBackground = COLOR_WINDOW;
	oc.lpszClassName = oglclass;

	if (!RegisterClassEx(&wc) || !RegisterClassEx(&oc)) {
		Error();
		return 1;
	}
	window = CreateWindowEx(WS_EX_CLIENTEDGE, wndclass, "OpenGL", WS_OVERLAPPEDWINDOW,
	                        CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, inst, NULL);
	if (window == NULL) {
		Error();
		return 1;
	}
	ShowWindow(window, show);
	UpdateWindow(window);

	while (GetMessage(&msg, NULL, 0, 0) > 0) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}
This part of the code runs fine, but when it gets to WM_CREATE for the window I just made it throws me an error because it couldn't create neither of the two child windows with the error message "Cannot create a top-level child window.".

The wndproc function, cut off to show the important parts:
Code:
LRESULT CALLBACK wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	static HWND ogl;
	static HWND con;
	static int fonth;

	switch (msg) {
		case WM_CREATE:
		{
			HFONT font, oldfont;
			HDC condc;
			TEXTMETRIC tm;

			font = CreateFont(-MulDiv(12, GetDeviceCaps(GetDC(hwnd), LOGPIXELSY), 72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("MS Shell Dlg"));
			/*Here comes the trouble makers*/
			ogl = CreateWindowEx(0, oglclass, TEXT(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 0, 0, window, NULL, GetModuleHandle(NULL), NULL);
			con = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("EDIT"), TEXT(""), WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL, 0, 0, 0, 0, window, NULL, GetModuleHandle(NULL), NULL);
			if (font == NULL || ogl == NULL || con == NULL) { /*End of the line*/
				Error();
				PostQuitMessage(1);
				break;
			}
			oldconproc = SetWindowLongPtr(con, GWLP_WNDPROC, (LONG_PTR) conproc);
			SendMessage(con, WM_SETFONT, (WPARAM) font, MAKELPARAM(FALSE, 0));
			condc = GetDC(con);
			oldfont = SelectObject(condc, font);
			GetTextMetrics(condc, &tm);
			SelectObject(condc, oldfont);
			ReleaseDC(con, condc);
			fonth = tm.tmHeight;
			break;
		}
'ogl' is the child window that is to draw the OpenGL stuff and 'con', for console, is the edit control.
Looking up the error message doesn't help me solve my problem, "As part of its user interface, an application has tried to create a child window at an inappropriate level.", what are these "levels" to begin with?