case WM_CREATE: { MessageBox(hwnd, "WM_CREATE passed", "INFO", MB_OK); GetClientRect(hwnd, &rect); WNDCLASS wc; memset(&wc, 0, sizeof(WNDCLASS)); wc.hbrBackground = (HBRUSH)COLOR_WINDOW+1; wc.hIcon = NULL; wc.lpfnWndProc = ChildProc; wc.lpszClassName = "SubClass"; RegisterClass(&wc); hChild = CreateWindowEx( WS_EX_CLIENTEDGE, wc.lpszClassName, 0, WS_CHILD | WS_VISIBLE, 10, 20, 30, 30, //x y xW yW hwnd, NULL, GetModuleHandle(0), 0 ); if (!hChild) { char buffer[100]; sprintf(buffer, "Fatal errorcode: %d\r\n", GetLastError()); MessageBox(hwnd, buffer, "FATAL ERROR", MB_OK|MB_ICONERROR); } } break;