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
You can't get the real exact size - you can get an approximation that depends on the DPI setting in windows, and the resolution of the screen, but you can't guarantee that this is the real size.
Especially in a multimonitor situation with different displays (say a 19" CRT and 24" LCD). Further, if the display is CRT then the measurement is the tube measurement, and not the display area.
When programs have needed this information exactly in the past, they've shown a gauge onscreen, and had the user hold a piece of paper up to the screen and measure the paper width with the gauge. Given the paper is 8.5" or A4 then you know the width, and you can use the number that they input to figure out the real DPI for a given display. You may need to have them do that for each monitor in a multimonitor setup.
-Adam