SetThreadDpiAwarenessContext function (winuser.h)

Set the DPI awareness for the current thread to the provided value.

Syntax

DPI_AWARENESS_CONTEXT SetThreadDpiAwarenessContext(
  [in] DPI_AWARENESS_CONTEXT dpiContext
);

Parameters

[in] dpiContext

The new DPI_AWARENESS_CONTEXT for the current thread. This context includes the DPI_AWARENESS value.

Return value

The old DPI_AWARENESS_CONTEXT for the thread. If the dpiContext is invalid, the thread will not be updated and the return value will be NULL. You can use this value to restore the old DPI_AWARENESS_CONTEXT after overriding it with a predefined value.

Remarks

Use this API to change the DPI_AWARENESS_CONTEXT for the thread from the default value for the app.

Requirements

Requirement 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

DPI_AWARENESS