public void HookKeyboard() { _HookProc = new WinAPI.HookProcDelegate(KeyboardHookProc); _HookHandle = WinAPI.SetWindowsHookEx(WinAPI.WH_KEYBOARD_LL, _HookProc, IntPtr.Zero, 0); if (_HookHandle != 0) { Debug.WriteLine("Keyboard hooked"); } }
public void HookMouse() { _HookProc = new WinAPI.HookProcDelegate(MouseHookProc); _HookHandle = WinAPI.SetWindowsHookEx(WinAPI.WH_MOUSE_LL, _HookProc, IntPtr.Zero, 0); if (_HookHandle != 0) { Debug.WriteLine("Mouse hooked"); } }