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