How to obtain the correct physical size of the monitor?

后端 未结 7 1374
闹比i
闹比i 2020-12-01 10:13

How can I get the size of the display in centimeters or inches?

This code does not always works correctly:

HDC hdc = CreateDC(_T(\"DISPLAY\"),dd.Devi         


        
7条回答
  •  旧时难觅i
    2020-12-01 10:26

    You can request LOGPIXELSX from GetDeviceCaps to get the DPI for the display, though it will generally return 96. See also this MSDN article on writing DPI-aware apps.

提交回复
热议问题