diff --git a/GreenshotPlugin/Core/WindowDetails.cs b/GreenshotPlugin/Core/WindowDetails.cs
index 10f087163..883c7aa1e 100644
--- a/GreenshotPlugin/Core/WindowDetails.cs
+++ b/GreenshotPlugin/Core/WindowDetails.cs
@@ -548,13 +548,21 @@ namespace GreenshotPlugin.Core
User32.ShowWindow(Handle, ShowWindowCommand.Hide);
}
+ ///
+ /// Returns if this window is cloaked
+ ///
+ public bool IsCloaked
+ {
+ get => DWM.IsWindowCloaked(Handle);
+ }
+
///
/// Gets whether the window is visible.
///
public bool Visible {
get {
// Tip from Raymond Chen
- if (DWM.IsWindowCloaked(Handle))
+ if (IsCloaked)
{
return false;
}
@@ -1525,6 +1533,12 @@ namespace GreenshotPlugin.Core
/// bool
private static bool IsTopLevel(WindowDetails window)
{
+ // Window is not on this desktop
+ if (window.IsCloaked)
+ {
+ return false;
+ }
+
// Ignore windows without title
if (window.Text.Length == 0)
{
@@ -1535,7 +1549,7 @@ namespace GreenshotPlugin.Core
return false;
}
// Windows without size
- if (window.WindowRectangle.Size.IsEmpty)
+ if (window.WindowRectangle.Size.Width * window.WindowRectangle.Size.Height == 0)
{
return false;
}
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index e912f8839..25ca84c4f 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -19,10 +19,13 @@ stages:
vmImage: 'Windows-latest'
variables:
- solution: 'Greenshot.sln'
- buildPlatform: 'Any CPU'
- buildConfiguration: 'Release'
- group: 'Plug-in Credentials'
+ - group: 'Plug-in Credentials'
+ - name: solution
+ value: 'Greenshot.sln'
+ - name: buildPlatform
+ value: 'Any CPU'
+ - name: buildConfiguration
+ value: 'Release'
steps:
- task: NuGetToolInstaller@1