public static IntPtr SetWindowsHookEx(NativeMethods.HookType hookType, NativeMethods.HookProc lpfn, IntPtr hMod, int dwThreadId) { Contract.Ensures(Contract.Result <IntPtr>() != IntPtr.Zero); var handle = UnsafeNativeMethods.SetWindowsHookEx(hookType, lpfn, hMod, dwThreadId); ThrowLastError(handle == IntPtr.Zero); return(handle); }
public static extern IntPtr SetWindowsHookEx([MarshalAs(UnmanagedType.I4)] NativeMethods.HookType hookType, [MarshalAs(UnmanagedType.FunctionPtr)] NativeMethods.HookProc lpfn, IntPtr hMod, int dwThreadId);