Windows Dev Center

Expand Minimize

GetWindowDisplayAffinity function

Retrieves the current display affinity setting, from any process, for a given window.

Syntax


BOOL WINAPI GetWindowDisplayAffinity(
  _In_  HWND  hWnd,
  _Out_ DWORD *dwAffinity
);

Parameters

hWnd [in]

Type: HWND

A handle to the window.

dwAffinity [out]

Type: DWORD*

The display affinity setting.

Return value

Type:

Type: BOOL

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.

Remarks

This function currently only supports one flag, WDA_MONITOR (0x01). This flag enables a window's contents to be displayed only on the monitor.

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.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Conceptual
Windows

 

 

Community Additions

ADD
Show:
© 2015 Microsoft