diff --git a/Greenshot/Helpers/CaptureHelper.cs b/Greenshot/Helpers/CaptureHelper.cs index 8b1bf2fa7..b6af78d4b 100644 --- a/Greenshot/Helpers/CaptureHelper.cs +++ b/Greenshot/Helpers/CaptureHelper.cs @@ -897,6 +897,13 @@ namespace Greenshot.Helpers { #region capture with feedback private void CaptureWithFeedback() { using (CaptureForm captureForm = new CaptureForm(capture, windows)) { + // Added check for metro (Modern UI) apps, which might be maximized and cover the screen. + // as they don't want to + foreach(WindowDetails app in WindowDetails.GetMetroApps()) { + if (app.Maximised) { + app.HideApp(); + } + } DialogResult result = captureForm.ShowDialog(); if (result == DialogResult.OK) { selectedCaptureWindow = captureForm.SelectedCaptureWindow; diff --git a/GreenshotPlugin/Core/WindowsHelper.cs b/GreenshotPlugin/Core/WindowsHelper.cs index 720faf557..5b9f13a3c 100644 --- a/GreenshotPlugin/Core/WindowsHelper.cs +++ b/GreenshotPlugin/Core/WindowsHelper.cs @@ -639,18 +639,6 @@ namespace GreenshotPlugin.Core { /// Gets/Sets whether the window is maximised or not. /// public bool Maximised { - get { - return User32.IsZoomed(this.hWnd); - } - set { - User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero); - } - } - - /// - /// Gets whether the window is visible. - /// - public bool Visible { get { if (isApp) { Rectangle windowRectangle = WindowRectangle; @@ -670,14 +658,42 @@ namespace GreenshotPlugin.Core { } } } - } else { - // Not Fullscreen -> Than it's visible! - return true; } } } return false; } + return User32.IsZoomed(this.hWnd); + } + set { + if (value) { + User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero); + } else { + User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero); + } + } + } + + /// + /// This doesn't work as good as is should, but does move the App out of the way... + /// + public void HideApp() { + User32.ShowWindow(Handle, ShowWindowCommand.Hide); + } + + /// + /// Gets whether the window is visible. + /// + public bool Visible { + get { + if (isApp) { + Rectangle windowRectangle = WindowRectangle; + foreach (Screen screen in Screen.AllScreens) { + if (screen.Bounds.Contains(windowRectangle)) { + return true; + } + } + } if (isAppLauncher) { return IsAppLauncherVisible; } @@ -744,7 +760,7 @@ namespace GreenshotPlugin.Core { GetWindowRect(out windowRect); } - if (!HasParent && this.Maximised) { + if (!HasParent && (!isApp && Maximised)) { Size size = Size.Empty; GetBorderSize(out size); windowRect = new Rectangle(windowRect.X + size.Width, windowRect.Y + size.Height, windowRect.Width - (2 * size.Width), windowRect.Height - (2 * size.Height)); @@ -1656,7 +1672,7 @@ namespace GreenshotPlugin.Core { /// /// public static WindowDetails GetAppLauncher() { - IntPtr appLauncher = User32.FindWindow("ImmersiveLauncher", null); + IntPtr appLauncher = User32.FindWindow(METRO_APPLAUNCHER_CLASS, null); if (appLauncher != IntPtr.Zero) { return new WindowDetails (appLauncher); }