GetDpiForWindow
GetDpiForWindow is a Windows API function in User32.dll that returns the dots-per-inch (DPI) value for a specific window. It is used to support per-window DPI awareness by allowing an application to adjust layout and rendering on a per-window basis.
The function signature is UINT GetDpiForWindow(HWND hwnd). The hwnd parameter identifies the target window. The returned
Return value: The function returns the DPI as an unsigned value in DPI units (for example, 96
Usage: Call GetDpiForWindow on the thread that owns the window, typically after window creation or when a
See also: GetDpiForSystem, SetProcessDpiAwarenessContext, WM_DPICHANGED.