I'm creating a window as a child of a window of another process. Everything works fine unless the parent happens to be minimized when I create the window. Then my window is never displayed. I get WM_NCCREATE, WM_NCCALCSIZE, WM_CREATE, WM_SIZE, WM_MOVE and WM_SHOWWINDOW. After that nothing except WM_DESTROY when the parent is destroyed.
Any idea what causes this and how to fix it? Preferably without hooking the parent.
// Class registration and error checking omitted for brevity.
WNDCLASSEX wc;
memset(&wc, 0, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.hInstance = hInstance;
wc.lpfnWndProc = windowProc;
wc.hCursor = LoadCursor(0, IDC_ARROW);
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszClassName = "WindowClass";
HWND hwnd = CreateWindowEx(0, "WindowClass", "Window",
WS_CHILD, 10, 10, 200, 200, parent, 0, hInstance, 0);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
Edit:
@Ben Voigt: No. My window doesn't get any messages between WM_SHOWWINDOW and WM_DESTROY. The parent is a simple QWidget I created for testing.
Your comment got me thinking about the parent's role in this. I replaced the QWidget with a simple Win32 window and the problem disappeared. I'm not sure what happened, maybe it's some internal QT thing... Case closed anyway.