How to hook external process with SetWindowsHookEx and WH_KEYBOARD
I am trying to hook for example Notepad without sucess. Making a global hook seems to work fine. Testing on XP SP2. Edit: Amended code works now. MyDLL code #include <windows.h> #include <iostream> #include <stdio.h> HINSTANCE hinst; #pragma data_seg(".shared") HHOOK hhk; #pragma data_seg() //#pragma comment(linker, "/SECTION:.shared,RWS") compiler error in VC++ 2008 express LRESULT CALLBACK wireKeyboardProc(int code, WPARAM wParam,LPARAM lParam) { if (code < 0) { return CallNextHookEx(0, code, wParam, lParam); } Beep(1000, 20); return CallNextHookEx(hhk, code, wParam, lParam); } extern "C" _