Click to See Complete Forum and Search --> : Display metrics in metric


EnquiringCoder
August 4th, 2005, 09:02 PM
I was wondering if anyone knows of an API call in the PSDK/WinAPI for determining the display width and height in millimeters?

Using xlib, you can determine this with calls to int XWidthMMOfScreen(Screen *screen) and XHeightMMOfScreen(Screen *screen) to determine the dimensions of the display in millimeters.

Thanks

olivthill
August 5th, 2005, 03:06 AM
Yes, you have GetSystemMetrics(), and you also have GetDeviceCaps().

Unfortunately, it seems that GetDeviceCaps() does not return a correct physical size of the screen in some cases. There has been a recent thread on this subject, http://www.codeguru.com/forum/showthread.php?t=348483, where several persons measured their screen size and compared it with the size returned by Windows API.

But I would be inclined to bet that the same discrepancies can be seen with Xlib APIs, because monitors are often working with a generic driver who doesn't know the exact physical size of the screen.