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