February 17th, 2012, 09:32 AM
GetDeviceCaps issue in Windows 7, wrong size
I am having an issue with my application now that I am starting to use newer Windows 7 computers. I know that this is a windows 7 issue because I have duplicated this on multiple computers, multiple monitors and even downgrading from Windows 7 to Windows XP on the same computers.
My output is is MM_HIMETRIC and I am plotting everything in specific sizes. Please don't give me all the reasons that I should use pixels instead of millimeters, I need to maintain the proper scale in metric on the screen and the printed values so it is much better for me to get the monitor display to work correctly than to re-write millions of lines of code that currently use the MM_HIMETRIC map mode.
Anyway, here is my exact problem...
WinXP Result ____ Win7 Result ____ Function Call
____ 320 __________ 564 ________ pDC->GetDeviceCaps(HORZSIZE)
____ 240 __________ 318 ________ pDC->GetDeviceCaps(VERTSIZE)
Since GetDeviceCaps is returning the wrong values in Windows 7 (XP values are correct when compared to measuring with a ruler), my output is being displayed at about 50 - 60% reduction in scale.
Does anyone know how I can get the correct values of the display's physical size in Windows 7?
I would rather not require the operator to enter the physical dimensions for the screen every time I install my program on a new computer - then scaling my CScrollView in metric, then switching to MM_ANISOTROPIC and using SetWindowExt() based on the operator entered values.
I have to believe that others have run into this problem as well and there must be a better solution out there.
Any help getting the correct values in Windows 7 would be a huge help.
Tags for this Thread
Click Here to Expand Forum to Full Width