private static IntPtr SetHook(GlobalKeyBoardMouseHooks.LowLevelKeyboardProc proc) { using (Process currentProcess = Process.GetCurrentProcess()) { using (ProcessModule mainModule = currentProcess.MainModule) return(NativeMethods.SetWindowsHookEx(13, proc, NativeMethods.GetModuleHandle(mainModule.ModuleName), 0U)); } }
internal static extern IntPtr SetWindowsHookEx( int idHook, GlobalKeyBoardMouseHooks.LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);