How to obtain the correct physical size of the monitor?
Posted
by KindDragon
on Stack Overflow
See other posts from Stack Overflow
or by KindDragon
Published on 2009-02-23T14:07:15Z
Indexed on
2010/04/30
21:57 UTC
Read the original article
Hit count: 199
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.DeviceName,NULL,NULL);
int width = GetDeviceCaps(hdc, HORZSIZE);
int height = GetDeviceCaps(hdc, VERTSIZE);
ReleaseDC(0, hdc)
Especially for multi-monitor configuration.
Update: I need to get the size just for ordinary monitors, which have a constant physical size.
© Stack Overflow or respective owner