GetSystemDpiForProcess function (winuser.h)

Retrieves the system DPI associated with a given process. This is useful for avoiding compatibility issues that arise from sharing DPI-sensitive information between multiple system-aware processes with different system DPI values.

Syntax

UINT GetSystemDpiForProcess(
  HANDLE hProcess
);

Parameters

hProcess

The handle for the process to examine. If this value is null, this API behaves identically to GetDpiForSystem.

Return value

The process's system DPI value.

Remarks

The return value will be dependent based upon the process passed as a parameter. If the specified process 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 of the given process.

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

GetDpiForSystem