GetWindowDisplayAffinity function (winuser.h)
Retrieves the current display affinity setting, from any process, for a given window.
BOOL GetWindowDisplayAffinity( [in] HWND hWnd, [out] DWORD *pdwAffinity );
A handle to the window.
A pointer to a variable that receives the display affinity setting. See SetWindowDisplayAffinity for a list of affinity settings and their meanings.
This function succeeds only when the window is layered and Desktop Windows Manager is composing the desktop. If this function succeeds, it returns TRUE; otherwise, it returns FALSE. To get extended error information, call GetLastError.
This function and SetWindowDisplayAffinity are designed to support the window content protection feature unique to Windows 7. This feature enables applications to protect their own onscreen window content from being captured or copied via a specific set of public operating system features and APIs. However, it works only when the Desktop Window Manager (DWM) is composing the desktop.
It is important to note that unlike a security feature or an implementation of Digital Rights Management (DRM), there is no guarantee that using SetWindowDisplayAffinity and GetWindowDisplayAffinity, and other necessary functions such as DwmIsCompositionEnabled, will strictly protect windowed content, as in the case where someone takes a photograph of the screen.
|Minimum supported client||Windows 7 [desktop apps only]|
|Minimum supported server||Windows Server 2008 R2 [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|API set||ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows 8.1)|