I have a large C++ legacy appliaction using MFC.
In different places throughout the UI (views, dialogs, custom controls derived from CWnd) I get the WM_KEYDOWN message to copy some information to the clipboard for testing purposes. For instance the content of grid/list in a specific moment.
I would like to use a keyboard hook to centralize the implementation of all this testing hooks but I don't know how to get the window that will eventually get the WM_KEYDOWN message.
For instance if user press Ctrl+I in a grid control (the focus is in the control itself) I want to call a function in the grid that copy information of the grid (row, cols, etc.) to the clipboard. But if the focus is in anyother control of the dialog I want to call a method of the dialog exporting information of the dialog.
This is the syntax of the callback:
LRESULT CALLBACK KeyboardProc( In int code, In WPARAM wParam, In LPARAM lParam );
But there is no information of the CWnd that has the focus and therfore will get the key down message.