GetDpiForSystem function

Returns the system DPI.

Syntax

UINT GetDpiForSystem();

Parameters

This function has no parameters.

Return value

The system DPI value.

Remarks

The return value will be dependent based upon the calling context. If the current thread has a DPI_AWARENESS value of DPI_AWARENESS_UNAWARE, the return value will be 96. That is because the current context always assumes a DPI of 96. For any other DPI_AWARENESS value, the return value will be the actual system DPI.

You should not cache the system DPI, but should use GetDpiForSystem whenever you need the system DPI value.

Requirements

   
Minimum supported client Windows 10, version 1607 [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

DPI_AWARENESS