diff --git a/Greenshot/Helpers/CaptureHelper.cs b/Greenshot/Helpers/CaptureHelper.cs index 8b0c272a6..a481c7f08 100644 --- a/Greenshot/Helpers/CaptureHelper.cs +++ b/Greenshot/Helpers/CaptureHelper.cs @@ -678,7 +678,7 @@ namespace Greenshot.Helpers { // 3) Otherwise use GDI (Screen might be also okay but might lose content) if (isAutoMode) { // TODO: Decided if this is smart, although we do consider a part of the window... - if (conf.IECapture && IECaptureHelper.IsMostlyIEWindow(windowToCapture, 60)) { + if (conf.IECapture && IECaptureHelper.IsMostlyIEWindow(windowToCapture, 75)) { try { ICapture ieCapture = IECaptureHelper.CaptureIE(captureForWindow, windowToCapture); if (ieCapture != null) { diff --git a/Greenshot/Helpers/IECaptureHelper.cs b/Greenshot/Helpers/IECaptureHelper.cs index 0e499c004..5aeac1047 100644 --- a/Greenshot/Helpers/IECaptureHelper.cs +++ b/Greenshot/Helpers/IECaptureHelper.cs @@ -56,55 +56,61 @@ namespace Greenshot.Helpers { ieAccessible.ActivateIETab(tabIndex); } - /// - /// Return true if the supplied window has a sub-window which covers more than the supplied percentage - /// - /// WindowDetails to check - /// min percentage - /// - public static bool IsMostlyIEWindow(WindowDetails someWindow, int minimumPercentage) { - WindowDetails ieWindow = someWindow.GetChild("Internet Explorer_Server"); - if (ieWindow != null) { - Rectangle wholeClient = someWindow.ClientRectangle; - Rectangle partClient = ieWindow.ClientRectangle; - int percentage = (int)(100*((float)(partClient.Width * partClient.Height)) / ((float)(wholeClient.Width * wholeClient.Height))); - LOG.InfoFormat("Window {0}, ie part {1}, percentage {2}", wholeClient, partClient, percentage); - if (percentage > minimumPercentage) { - return true; - } - } - return false; - } + /// + /// Return true if the supplied window has a sub-window which covers more than the supplied percentage + /// + /// WindowDetails to check + /// min percentage + /// + public static bool IsMostlyIEWindow(WindowDetails someWindow, int minimumPercentage) { + WindowDetails ieWindow = someWindow.GetChild("Internet Explorer_Server"); + if (ieWindow != null) { + Rectangle wholeClient = someWindow.ClientRectangle; + Rectangle partClient = ieWindow.ClientRectangle; + int percentage = (int)(100*((float)(partClient.Width * partClient.Height)) / ((float)(wholeClient.Width * wholeClient.Height))); + LOG.InfoFormat("Window {0}, ie part {1}, percentage {2}", wholeClient, partClient, percentage); + if (percentage > minimumPercentage) { + return true; + } + } + return false; + } - /// - /// Does the supplied window have a IE part? - /// - /// - /// - public static bool IsIEWindow(WindowDetails someWindow) { - return someWindow.GetChild("Internet Explorer_Server") != null; - } + /// + /// Does the supplied window have a IE part? + /// + /// + /// + public static bool IsIEWindow(WindowDetails someWindow) { + return someWindow.GetChild("Internet Explorer_Server") != null; + } - /// - /// Get Windows displaying an IE - /// - /// List - public static List GetIEWindows() { - List ieWindows = new List(); - foreach (WindowDetails possibleIEWindow in WindowDetails.GetVisibleWindows()) { - if (IsIEWindow(possibleIEWindow)) { - ieWindows.Add(possibleIEWindow); - } - } - return ieWindows; - } + /// + /// Get Windows displaying an IE + /// + /// List + public static List GetIEWindows() { + List ieWindows = new List(); + foreach (WindowDetails possibleIEWindow in WindowDetails.GetAllWindows()) { + if (possibleIEWindow.Text.Length == 0) { + continue; + } + if (possibleIEWindow.ClientRectangle.IsEmpty) { + continue; + } + if (IsIEWindow(possibleIEWindow)) { + ieWindows.Add(possibleIEWindow); + } + } + return ieWindows; + } - /// + /// /// Simple check if IE is running /// /// bool public static bool IsIERunning() { - return GetIEWindows().Count > 0; + return GetIEWindows().Count > 0; } /// @@ -116,7 +122,7 @@ namespace Greenshot.Helpers { Dictionary> browserWindows = new Dictionary>(); // Find the IE windows - List ieWindows = GetIEWindows(); + List ieWindows = GetIEWindows(); foreach (WindowDetails ieWindow in ieWindows) { try { if (!ieHandleList.Contains(ieWindow.Handle)) {