private static IntPtr SetWindowsHook(Delegate HookProc, HOOKPROCID HookID) { using (Process process = Process.GetCurrentProcess()) using (ProcessModule module = process.MainModule) { return(SetWindowsHookEx(HookID, HookProc, GetModuleHandle(module.ModuleName), 0)); } }
private static extern IntPtr SetWindowsHookEx(HOOKPROCID idHook, Delegate lpfn, IntPtr hMod, uint dwThreadId);