mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
Hide background UWP apps from window capture options
UWP apps that aren't shown are 'cloaked'
This commit is contained in:
parent
d89dd984f4
commit
1bfb545d33
|
@ -207,6 +207,9 @@ public enum DwmWindowAttribute
|
|||
HasIconicBitmap,
|
||||
DisallowPeek,
|
||||
ExcludedFromPeek,
|
||||
Cloak,
|
||||
Cloaked,
|
||||
FreezeRepresentation,
|
||||
Last
|
||||
}
|
||||
|
||||
|
|
|
@ -392,6 +392,9 @@ public static partial class NativeMethods
|
|||
[DllImport("dwmapi.dll")]
|
||||
public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out bool pvAttribute, int cbAttribute);
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out int pvAttribute, int cbAttribute);
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
public static extern void DwmEnableBlurBehindWindow(IntPtr hwnd, ref DWM_BLURBEHIND blurBehind);
|
||||
|
||||
|
|
|
@ -349,6 +349,13 @@ public static bool IsWindowMaximized(IntPtr handle)
|
|||
return wp.showCmd == WindowShowStyle.Maximize;
|
||||
}
|
||||
|
||||
public static bool IsWindowCloaked(IntPtr handle)
|
||||
{
|
||||
int cloaked;
|
||||
int result = DwmGetWindowAttribute(handle, (int)DwmWindowAttribute.Cloaked, out cloaked, sizeof(int));
|
||||
return result == 0 && cloaked != 0;
|
||||
}
|
||||
|
||||
public static IntPtr SetHook(int hookType, HookProc hookProc)
|
||||
{
|
||||
using (Process currentProcess = Process.GetCurrentProcess())
|
||||
|
|
|
@ -54,7 +54,9 @@ public class WindowInfo
|
|||
|
||||
public bool IsMinimized => NativeMethods.IsIconic(Handle);
|
||||
|
||||
public bool IsVisible => NativeMethods.IsWindowVisible(Handle);
|
||||
public bool IsVisible => NativeMethods.IsWindowVisible(Handle) && !IsCloaked;
|
||||
|
||||
public bool IsCloaked => NativeMethods.IsWindowCloaked(Handle);
|
||||
|
||||
public bool IsActive => NativeMethods.GetForegroundWindow() == Handle;
|
||||
|
||||
|
|
Loading…
Reference in a new issue