IntPtr WndProc(IntPtr rpHandle, int rpMessage, IntPtr rpWParam, IntPtr rpLParam, ref bool rrpHandled) { if (rpMessage == (int)NativeConstants.WindowMessage.WM_HOTKEY) { var rModifierKeys = NativeUtils.LoWord(rpLParam); var rKey = NativeUtils.HiWord(rpLParam); if (Preference.Instance.Other.PanicKey.ModifierKeys == rModifierKeys && Preference.Instance.Other.PanicKey.Key == rKey) { var rCurrentProcessID = (uint)Process.GetCurrentProcess().Id; NativeMethods.User32.EnumWindows((rpWindowHandle, _) => { uint rProcessID; NativeMethods.User32.GetWindowThreadProcessId(rpHandle, out rProcessID); if (rProcessID != rCurrentProcessID && (BrowserService.Instance.BrowserProcessID.HasValue && rProcessID != BrowserService.Instance.BrowserProcessID.Value)) { return(false); } NativeMethods.User32.ShowWindowAsync(rpHandle, !IsPanicKeyPressed ? NativeConstants.ShowCommand.SW_HIDE : NativeConstants.ShowCommand.SW_SHOW); return(true); }, IntPtr.Zero); IsPanicKeyPressed = !IsPanicKeyPressed; } } return(IntPtr.Zero); }