Queries the specified monitor for the dots per inch (dpi) horizontal and vertical values.
STDAPI GetDpiForMonitor( _In_ HMONITOR hmonitor, _In_ MONITOR_DPI_TYPE dpiType, _Out_ UINT *dpiX, _Out_ UINT *dpiY );
Handle of the monitor being queried.
The type of dpi being queried.
Value Meaning MDT_EFFECTIVE_DPI 0
Effective dpi that incorporates accessibility overrides and matches what Desktop Window Manage (DWM) uses to scale desktop applications.
Dpi that ensures rendering at a compliant angular resolution on the screen, without incorporating accessibility overrides.
Linear dpi of the screen as measured on the screen itself.
The default value used if no other value is set.
The value of the dpi along the X axis. This value always refers to the horizontal edge, even when the screen is rotated.
The value of the dpi along the Y axis. This value always refers to the vertical edge, even when the screen is rotated.
If this function succeeds (the function successfully returns the X and Y dpi values for the specified monitor), it returns S_OK. Otherwise, it returns an HRESULT error code, including the following:
The handle, DPI type, or pointers passed in are not valid.
When the dpiType parameter is MDT_Effective_DPI, the returned dpi value includes any changes that the user made to the dpi by using the desktop scaling override slider control in Control Panel.
When the dpiType parameter is MDT_Angular_DPI or MDT_Raw_DPI, the returned dpi value does not include any changes that the user made to the dpi by using the desktop scaling override slider control in Control Panel.
For more information about dpi settings in Control Panel, see the Writing dpi-Aware Desktop Applications in Windows 8.1 white paper.
Minimum supported client
|Windows 8.1 [desktop apps only]|
Minimum supported server
|Windows Server 2012 R2 [desktop apps only]|
Build date: 1/13/2014