GetDpiFromDpiAwarenessContext function (winuser.h)

Retrieves the DPI from a given DPI_AWARENESS_CONTEXT handle. This enables you to determine the DPI of a thread without needed to examine a window created within that thread.

Syntax

UINT GetDpiFromDpiAwarenessContext(
  DPI_AWARENESS_CONTEXT value
);

Parameters

value

The DPI_AWARENESS_CONTEXT handle to examine.

Return value

The DPI value associated with the DPI_AWARENESS_CONTEXT handle.

Remarks

DPI_AWARENESS_CONTEXT handles associated with values of DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE and DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 will return a value of 0 for their DPI. This is because the DPI of a per-monitor-aware window can change, and the actual DPI cannot be returned without the window's HWND.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1803 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header winuser.h
Library User32.lib
DLL User32.dll

See also

DPI_AWARENESS_CONTEXT