public ForegroundWatchDog() { if (this.dele == null) { this.dele = new ForegroundWatchDog.WinEventDelegate(this.WinEventProc); } ForegroundWatchDog.SetWinEventHook(3U, 3U, IntPtr.Zero, this.dele, 0U, 0U, 0U); ForegroundWatchDog.SetWinEventHook(8U, 8U, IntPtr.Zero, this.dele, 0U, 0U, 0U); }
/// <summary> /// Enables a foreground checker that does the specified action to all windows that come to foreground and are not in AllowedApps /// </summary> public static void EnableForegroundWatchDog() { if (_foregroundChecker == null) _foregroundChecker = new ForegroundWatchDog(); _foregroundChecker.StartWatchDog(); }