#1960: Also ignore cloaked windows in region capture

This commit is contained in:
Jaex 2016-10-16 01:12:15 +03:00
parent dc1dce8b7a
commit a948c6f793
2 changed files with 8 additions and 6 deletions

View file

@ -351,12 +351,14 @@ public static bool IsWindowMaximized(IntPtr handle)
public static bool IsWindowCloaked(IntPtr handle) public static bool IsWindowCloaked(IntPtr handle)
{ {
if (!IsDWMEnabled()) if (IsDWMEnabled())
return false; {
int cloaked;
int result = DwmGetWindowAttribute(handle, (int)DwmWindowAttribute.Cloaked, out cloaked, sizeof(int));
return result == 0 && cloaked != 0;
}
int cloaked; return false;
int result = DwmGetWindowAttribute(handle, (int)DwmWindowAttribute.Cloaked, out cloaked, sizeof(int));
return result == 0 && cloaked != 0;
} }
public static IntPtr SetHook(int hookType, HookProc hookProc) public static IntPtr SetHook(int hookType, HookProc hookProc)

View file

@ -111,7 +111,7 @@ private bool EvalControl(IntPtr hWnd, IntPtr lParam)
private bool CheckHandle(IntPtr handle, bool isWindow) private bool CheckHandle(IntPtr handle, bool isWindow)
{ {
if (handle == IgnoreHandle || !NativeMethods.IsWindowVisible(handle)) if (handle == IgnoreHandle || !NativeMethods.IsWindowVisible(handle) || (isWindow && NativeMethods.IsWindowCloaked(handle)))
{ {
return true; return true;
} }