I have a program which has two windows, one for displaying graphics (call this the "graphics window"), the other for entering and displaying text (call this the "text window"). The text window is a child of the graphics window. The program processes keystrokes correctly so long as the text window is highlighted, but if the graphics window is highlighted, the keystrokes are ignored. What I want to do is to arrange for the text window to processes keystrokes even if the graphics window is highlighted.
problem solved:
The text window is itself the parent of a rich edit window.
Inside the graphics window's message handler I have added:
case WM_CHAR:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
SendMessage(handle_of_rich_edit_window, message, wParam, lParam);
break;
I had previously tried sending the messages to the text window, but this appeared not to work (I have no idea why). Sending the messages directly to the richedit window seemed to do the trick.