I\'m trying to hook a button click in a mfc window.And I used WM_COMMAND and WM_NOTIFY.For test, if the button is clicked, the hook must create a messagebox. The problem is
The lParam for a WH_CALLWNDPROC hook is of type CWPSTRUCT. Your CallWndProc should look like this:
lParam
CallWndProc
// ... const CWPSTRUCT& cwps = *(CWPSTRUCT*)lParam; switch ( cwps.message ) { case WM_COMMAND: MessageBox( ... ); break; // ...