The obvious test is
IsWindowVisible()
, which checks whether the window and all its parents have theWS_
window style. If a window is not visible, then it doesn’t appear on the list.VISIBLE
But that will still find things like windows that belong to non-current virtual desktops, or bits of the shell that are currently not visible, or some UWP apps. What’s up with that?
The shell has a concept called cloaking, in which a window is given all the trappings of visibility, without actually being presented to the user. As far as the app can tell, it seems to be visible: It still has the
WS_VISIBLE
window style, its coordinates are still within the bounds of the monitor, it still getsWM_
messages, it has a non-empty clipping region, all the ways a traditional Win32 app has of detecting whether it is on screen say, “Yup, you’re on screen. Everything is just fine!”PAINT
BOOL IsWindowCloaked(HWND hwnd) { BOOL isCloaked = FALSE; return (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &isCloaked, sizeof(isCloaked))) && isCloaked; }
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CABhLwTUpAXyMca%2BPTMVtEb7-UTU0eAaZBTFgoVCo4ctCBmGrBQ%40mail.gmail.com.
Hi, ui/ OWNERS (and Jamie):I just found this note on Raymond Chen's blog about a new window visibility mode in win10, "cloaked": https://devblogs.microsoft.com/oldnewthing/20200302-00/?p=103507The obvious test is
IsWindowVisible()
, which checks whether the window and all its parents have theWS_
window style. If a window is not visible, then it doesn’t appear on the list.VISIBLE
But that will still find things like windows that belong to non-current virtual desktops, or bits of the shell that are currently not visible, or some UWP apps. What’s up with that?
The shell has a concept called cloaking, in which a window is given all the trappings of visibility, without actually being presented to the user. As far as the app can tell, it seems to be visible: It still has the
WS_VISIBLE
window style, its coordinates are still within the bounds of the monitor, it still getsWM_
messages, it has a non-empty clipping region, all the ways a traditional Win32 app has of detecting whether it is on screen say, “Yup, you’re on screen. Everything is just fine!”PAINT
It might be worth auditing calls to ::IsWindowVisible to see if they need to also check the "cloaked" state, which is detected with:BOOL IsWindowCloaked(HWND hwnd) { BOOL isCloaked = FALSE; return (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &isCloaked, sizeof(isCloaked))) && isCloaked; }I did a quick scan for IsWindowVisible calls and found a bunch throughout ui/ that don't handle the new cloaked state, eg: