Sent when the effective dots per inch (dpi) for a window has changed. The DPI is the scale factor for a window. There are multiple events that can cause the DPI to change. The following list indicates the possible causes for the change in DPI.

  • The window is moved to a new monitor that has a different DPI.
  • The window is created on a monitor that is not set to the default value of 100%. 100% is 96 dots per inch.
  • The DPI of the monitor hosting the window changes.

The current DPI for a window always equals the last DPI sent by WM_DPICHANGED. This is the scale factor that the window should be scaling to for apps that are aware of DPI changes.

#define WM_DPICHANGED       0x02E0



The HIWORD of the wParam contains the Y-axis value of the new dpi of the window. The LOWORD of the wParam contains the X-axis value of the new DPI of the window. For example, 96, 120, 144, or 192. The values of the X-axis and the Y-axis are identical for Windows apps.


A pointer to a RECT structure that provides a suggested size and position of the current window scaled for the new DPI. The expectation is that apps will reposition and resize windows based on the suggestions provided by lParam when handling this message.

Return value

If an application processes this message, it should return zero.


In order for applications to receive this message, they must be PROCESS_PER_MONITOR_DPI_AWARE applications. For more information about the different types of awareness, see PROCESS_DPI_AWARENESS. You only need to use either the X-axis or the Y-axis value when scaling your application since they are the same.

In order to handle this message correctly, you will need to resize and reposition your window based on the suggestions provided by lParam and using SetWindowPos. If you do not do this, your window will grow or shrink with respect to everything else on the new monitor. For example, if a user is using multiple monitors and drags your window from a 96 DPI monitor to a 192 DPI monitor, your window will appear to be half as large with respect to other items on the 192 DPI monitor.

The base value of DPI is defined as USER_DEFAULT_SCREEN_DPI which is set to 96. To determine the scaling factor for a monitor, take the DPI value and divide by USER_DEFAULT_SCREEN_DPI. The following table provides some sample DPI values and associated scaling factors.

DPI valueScaling percentage


The following example provides a sample DPI change handler.

        g_dpi = HIWORD(wParam);

        RECT* const prcNewWindow = (RECT*)lParam;
            prcNewWindow ->left,
            prcNewWindow ->top,
            prcNewWindow->right - prcNewWindow->left,
            prcNewWindow->bottom - prcNewWindow->top,

The following code linearly scales a value from 100% (96 DPI) to an arbitrary DPI defined by g_dpi.

    INT iBorderWidth100 = 5;
    iBorderWidth = MulDiv(iBorderWidth100, g_dpi, USER_DEFAULT_SCREEN_DPI);

An alternative way to scale a value is to convert the DPI value into a scale factor and use that.

    INT iBorderWidth100 = 5;
    FLOAT fscale = (float) g_dpi / USER_DEFAULT_SCREEN_DPI;
    iBorderWidth = iBorderWidth100 * fscale;


Minimum supported client

Windows 8.1 [desktop apps only]

Minimum supported server

Windows Server 2012 R2 [desktop apps only]



See also




Community Additions

© 2015 Microsoft