From 180cc1c6611a3a463676631729cddac5e8311266 Mon Sep 17 00:00:00 2001 From: RKrom Date: Thu, 8 Nov 2012 07:03:53 +0000 Subject: [PATCH] Fixed DWM capture for Metro (Modern UI) Apps by not placing it in the foreground. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2248 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotPlugin/Core/WindowsHelper.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/GreenshotPlugin/Core/WindowsHelper.cs b/GreenshotPlugin/Core/WindowsHelper.cs index 6e66afe2e..8815e49ab 100644 --- a/GreenshotPlugin/Core/WindowsHelper.cs +++ b/GreenshotPlugin/Core/WindowsHelper.cs @@ -865,8 +865,10 @@ namespace GreenshotPlugin.Core { tempForm.BackColor = Color.Black; // Make sure everything is visible tempForm.Refresh(); - // Make sure the application window is active, so the colors & buttons are right - ToForeground(); + if (!isMetroApp) { + // Make sure the application window is active, so the colors & buttons are right + ToForeground(); + } // Make sure all changes are processed and visisble Application.DoEvents(); using (Bitmap blackBitmap = WindowCapture.CaptureRectangle(captureRectangle)) { @@ -895,8 +897,10 @@ namespace GreenshotPlugin.Core { } // Make sure everything is visible tempForm.Refresh(); - // Make sure the application window is active, so the colors & buttons are right - ToForeground(); + if (!isMetroApp) { + // Make sure the application window is active, so the colors & buttons are right + ToForeground(); + } // Make sure all changes are processed and visisble Application.DoEvents(); // Capture from the screen