From 27f122280166348b55ab855d804a73438a9d9b33 Mon Sep 17 00:00:00 2001 From: Daniel Pedigo Date: Wed, 19 Aug 2015 23:44:35 -0600 Subject: [PATCH] Fixes bug #1191 (overlay window appearing in alt-tab switcher) --- Hearthstone Deck Tracker/Utility/User32.cs | 7 ++++--- Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Hearthstone Deck Tracker/Utility/User32.cs b/Hearthstone Deck Tracker/Utility/User32.cs index 58ca3c06dd..3df402016f 100644 --- a/Hearthstone Deck Tracker/Utility/User32.cs +++ b/Hearthstone Deck Tracker/Utility/User32.cs @@ -24,7 +24,8 @@ public enum MouseEventFlags : uint Wheel = 0x00000800 } - private const int WsExTransparent = 0x00000020; + public const int WsExTransparent = 0x00000020; + public const int WsExToolWindow = 0x00000080; private const int GwlExstyle = (-20); public const int SwRestore = 9; private static DateTime _lastCheck; @@ -66,10 +67,10 @@ public enum MouseEventFlags : uint [DllImport("user32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - public static void SetWindowExTransparent(IntPtr hwnd) + public static void SetWindowExStyle(IntPtr hwnd, int style) { var extendedStyle = GetWindowLong(hwnd, GwlExstyle); - SetWindowLong(hwnd, GwlExstyle, extendedStyle | WsExTransparent); + SetWindowLong(hwnd, GwlExstyle, extendedStyle | style); } public static bool IsHearthstoneInForeground() diff --git a/Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs b/Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs index b51b572736..31e0fa70f9 100644 --- a/Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs +++ b/Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs @@ -497,7 +497,7 @@ private void ReSizePosLists() private void Window_SourceInitialized_1(object sender, EventArgs e) { var hwnd = new WindowInteropHelper(this).Handle; - User32.SetWindowExTransparent(hwnd); + User32.SetWindowExStyle(hwnd, User32.WsExTransparent | User32.WsExToolWindow); } public void Update(bool refresh)