Hi. I asked a question, and some people commented that my question wasn't clear, So here is a new one.
I'm trying to create an application with multiple windows using the WIN32 API. I created two windows, one is a child of the parent. Then i have a message loop, But unfortunately only the parent WndProc gets message, while the child does not. - that is the wndProc is being called only once instead of twice. ( is that the expected behaviour? )
I also tried creating another WndProcChild Function for the child window, and registering its own class, but still to no avail.
Below is a code extract ( only the declaration of the child window, and the message loop )
I'm a Win32 newbie, so be gentle... Thanks, Dan
wcEdit.lpfnWndProc = WndProcChild;
wcEdit.style = CS_HREDRAW | CS_VREDRAW;
wcEdit.cbClsExtra = 0;
wcEdit.cbWndExtra = 0;
wcEdit.hInstance = hInstance;;
wcEdit.hCursor = 0;
wcEdit.lpszMenuName = 0;
wcEdit.lpszClassName = L"child";
RegisterClass(&wcEdit);
edit_hwnd = CreateWindow(L"child", L"child_title", NULL,
0, 0, 0, 0, ParentWindow,
NULL, global_instance, NULL);
UpdateWindow(edit_hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Just to explain again what i want to achieve - i want to handle a WM_KEYDOWN message twice - once in the parent window and once in the child window. I actually don't need them to be parent-child, just thought that would save me creating two different wndProcs