public void WinEventHookRange(Win32.WinEvent min, Win32.WinEvent max, Win32.WinEventProc callback) { var windowEventHook = Win32.SetWinEventHook( (int)min, // eventMin (int)max, // eventMax IntPtr.Zero, // hmodWinEventProc callback, // lpfnWinEventProc 0, // idProcess 0, // idThread //since both of the above params are 0, its a global hook Win32.WINEVENT_OUTOFCONTEXT); if (windowEventHook == IntPtr.Zero) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }
public void WinEventHook(Win32.WinEvent @event, Win32.WinEventProc callback) { WinEventHookRange(@event, @event, callback); }