private static IntPtr SetHook(LowLevelKeyboardProc proc) { using (Process curProcess = Process.GetCurrentProcess()) { using (ProcessModule curModule = curProcess.MainModule) { return(HotKeyManager.SetWindowsHookEx(HotKeyManager.WH_KEYBOARD_LL, proc, HotKeyManager.GetModuleHandle(curModule.ModuleName), 0)); } } }