I did read the docs about CreateWindow(), but it doesn't seem to explain anything about creating child windows?
I've been Googling around for tutorials on this topic, but there really isn't much information available, so I've had to guesstimate which functions to call and where.
How do I call RegisterClassEx() for the child window?!
The only time it's being called at present is after initializing the global strings;
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_INSTALLER, szWindowClass, MAX_LOADSTRING);
LoadString(hInstance, IDC_INSTALLER_CHLD, szChldWndClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
This is what MyRegisterClass looks like:
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_INSTALLER));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_INSTALLER);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
Anyways, I added a function called EnumChildProc() that is supposed to (I think) redraw any child windows when the parent window has changed size. I found it in
this article.
BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
LPRECT rcParent;
int i, idChild;
idChild = GetWindowLong(hwndChild, GWL_ID);
if (idChild == IDC_INSTALLER_CHLD)
i = 0;
else
i = 2;
rcParent = (LPRECT) lParam;
MoveWindow(hwndChild,
(rcParent->right / 3) * i,
0,
rcParent->right / 3,
rcParent->bottom,
TRUE);
ShowWindow(hwndChild, SW_SHOW);
return TRUE;
}
I'm calling it from my WndProc() like so:
case WM_SIZE:
GetClientRect(hWnd, &rcClient);
EnumChildWindows(hWnd, EnumChildProc, (LPARAM) &rcClient);
return 0;
It doesn't seem to have helped anything though...
I am at a loss as to what to do at this point! :(