Hello Coders

Is there a way to find out what size monitor is being used.

GetSystemMetrics only returns the size in pixtel. I need to get the height and width of any monitor used in inchs.

Is there a way to do this.

Thanks in advance.
Posted on 2003-06-16 00:00:07 by cmax
You can use GetDeviceCaps for the monitor with index of LOGPIXELSX / LOGPIXELSY to get how many pixels are there in 1 inch. And use this in converting pixel to inch.

Hope it will help you
Posted on 2003-06-16 00:23:41 by rxbagain
Thank you
Thank you

rxbagain

I sounds like a good idea...
Posted on 2003-06-16 00:32:56 by cmax
You can also use HORZSIZE and VERTSIZE, the result is in millimeters but it's easy enough to convert. Devide by 25.4 (or 25 if you don't need to be too accurate)

invoke GetDC,NULL
mov hDC,eax
invoke GetDeviceCaps,hDC,HORZSIZE
mov edx,0
mov ecx,25
div ecx
push eax
invoke ReleaseDC,NULL,hDC
pop eax
Posted on 2003-06-16 00:37:51 by donkey
A little more accurate for insanely large monitors (useful for the JUMBOTRON)

invoke GetDC,NULL
mov hDC,eax
invoke GetDeviceCaps,hDC,HORZSIZE
shl eax,3
mov edx,0
mov ecx,206
div ecx
invoke ReleaseDC,NULL,hDC

A deviation of 0.5 inches per 1000
Posted on 2003-06-16 01:23:46 by donkey