GetDpiForSystem function (winuser.h)

Returns the system DPI.


UINT GetDpiForSystem();

Return value

The system DPI value.


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.


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

See also