private IntPtr SetHook(GlobalKeyboardHookProc proc) { using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { return(SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0)); } }
public GlobalKeyboardHook() { _proc = HookCallback; }
private static extern IntPtr SetWindowsHookEx(int idHook, GlobalKeyboardHookProc lpfn, IntPtr hMod, uint dwThreadId);