I want to determine if any window is visible to the user or hidden / closed. In Windows XP, I would use the GetClipBox () function and check the NULLREGION value or the empty RECT value. This worked fine, but on Windows Vista it does not work if another window closes the window. In this case, GetClipBox () returns a SIMPLEREGION with a non-empty RECT.
Does anyone know why this does not work on Vista or is there another way to check if a window is visible to the user?
, GetClipBox() NULLREGION DWM, - , ! DWM - ( , ) , , .
, , , .
, ! ( - , Windows Media, - , , , !) , ( XP on ) , , .
/TL; DR:
/ DWM, , , , , ( ! WM_PAINT , , , !).
Vista ? , , , XP. , Vista DWM , , , .
- / , , , Z-, , .
Vista ? , , , XP. Vista DWM, , .
, DWM. , :
GetClipBox() . . , , :
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
However, this disables the transparency effects while my application is running, which is undesirable. I would prefer a less intrusive solution.
Anyway, thanks for the tip!
Since you know what GetClipRect result is available for both XP and Vista (with DWM enabled and enabled), you can create a function to determine this, which takes different paths based on the OS. In psuedo code:
function bool IsWindowVisible() { bool isVisible = false; if (OSVersion == "XP") { // GetClipRect tests which run on XP and set isVisible } else if (OSVersion == "Vista") { if (DWMCompisitionEnabled == true) { // GetClipRect tests for Vista with DWM enabled and set isVisible } else { // GetClipRect tests for Vista with DWM disabled and set isVisible } } return isVisible; }
Source: https://habr.com/ru/post/1699151/More articles:Accessing Ruby objects using Python via XML-RPC? - pythonHow to create sql scripts to deploy a process definition in jBPM? - javaCan CArchive read and write from a specified location in a file? - mfcWhat should these comparisons be? - stringOutside click detection inside an iframe? - javascriptFork or copy user browser session in IE - c ++In a Java thread running as an administrator, how can we apply Unix privileges to login? - javacapturing global keys in Java - javacharacter encoding conversion using posix c - cПочему Карты, возвращаемые вызовом JAX-WS, всегда пусты? - javaAll Articles