I have made the simplest window program possible. It simply creates a parent window. I then try to create a child window, which works fine. I can move it around it behaves ok. I gave it a caption in a titlebar. But whenever I launch my program, the title bar for the child is always greyed out, even if I am dragging it around the screen. Also when the program starts, it seems the curved area around the top corners of the child window haven't been painted and there is a spot of black there. When I move the child they get painted correctly.
I can't figure out what style I have correctly entered to make it always appear greyed out, and why the corners are not initially the bg color of the parent window. Here I create the child window in my parent's CREATE message:
hwndChild= CreateWindow( szChildClass,
WS_VISIBLE | WS_THICKFRAME | WS_MINIMIZEBOX |WS_MAXIMIZEBOX | WS_CAPTION | WS_CHILDWINDOW | WS_CLIPSIBLINGS,
100, 100, 300, 200,
(HINSTANCE) GetWindowLong( hwnd, GWL_HINSTANCE ),
UpdateWindow( hwndChild );
My child's WndProc is nothing fancy and has all the basic parts to it. The only other thing I could see having an effect is the way I register my child window. I reigster it in WinMain() right after the parent has been registered:
// parent has just been registered.
wndchildclass .style = CS_HREDRAW | CS_VREDRAW;
wndchildclass .lpfnWndProc = ChildWndProc;
wndchildclass .cbWndExtra = sizeof( long );
wndchildclass .hIcon = NULL;
wndchildclass .lpszClassName = szChildClass;
wndchildclass .hbrBackground = (HBRUSH) GetStockObject( WHITE_BRUSH );
wndclass.hInstance = hInstance;
wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
RegisterClass( &wndchildclass );
What am I missing that makes the child window not be greyed out when you're moving it etc?