From cfcc5d085c465c0a13419dbd73ca91e47ef8bb74 Mon Sep 17 00:00:00 2001 From: Anton Kasyanov Date: Mon, 4 Mar 2019 22:37:10 +0200 Subject: [PATCH] Fix for the detection of the currently active non-EVE app --- Eve-O-Preview/Services/Implementation/ThumbnailManager.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs b/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs index a7bb0c9..005927c 100644 --- a/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs +++ b/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs @@ -196,7 +196,12 @@ namespace EveOPreview.Services } else if (!isClientWindow) { - this._externalApplication = foregroundWindowHandle; + // Under some circumstances Foreground WindowHandle can be zero + // (f.e. when Thumbnail is silently stealing focus from the currently open app) + if (foregroundWindowHandle != IntPtr.Zero) + { + this._externalApplication = foregroundWindowHandle; + } } // No need to minimize EVE clients when switching out to non-EVE window (like thumbnail)