Ironically, ShowWindow(hwndChild, SW_HIDE) (though SW_HIDE does not cause the same evilness with child windows as it does with displayed windows). You can use EnableWindow in addition to that if you're extra paranoid (like me), but generally hiding the child window should be enough.
So you would set it up like this:
Code:
INT_PTR
MainWindowProc(...)
{
WM_CREATE:
// create child window class
WNDCLASSEX wcxChild;
// fill out its fields
...
wcxChild.lpszClassName = Child1Name; // give child1 class a name
wcxChild.lpfnWndProc = Child1Proc; // give it a window function
RegisterClassex(&wcxChild); // register it
// create child window 1
CreateWindow(WS_EX_CONTROLPARENT, child1Name,..., WS_CHILD | WS_VISIBLE, x, y, w, h, hwndParent, child1ID, hInst, ...);
wcxChild.lpszClassName = Child2Name; // give child2 class a name
wcxChild.lpfnWndProc = Child2Proc; // give it a window function
RegisterClassex(&wcxChild); // register it
CreateWindow(..., child2Name, ... child2ID,...);
// repeat these steps (name, func, register, create) for each child window
...
WM_NCDESTROY:
// after this window is destroyed, if you no longer
// need the child windows, unregister their classes to free memory
// (no need to do this if your entire app is exiting though)
Unregister(Child1Name, hInst);
Unregister(Child2Name, hInst);
...
}
INT_PTR
Child1Proc(...)
{
WM_CREATE:
// create child1 controls here
....
WM_COMMAND:
// hande child1 messages here (or you can pass them onto parent)
}
INT_PTR
Child2Proc(...)
{
WM_CREATE:
// create child2 controls here
....
WM_COMMAND:
// hande child2 messages here (or you can pass them onto parent)
}
...