<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>Jay, I ran your program on a Lenovo/IBM ThinkPad T60 running at 1280x1024 resolution. Here are the results:</DIV>
<DIV> </DIV>
<DIV>horizonal pixels 1280<BR>veritical pixels SM_CYSCREEN 1024<BR>horizontal millimeters 375<BR>veritical millimeters 300<BR>horizontal pixels per millimeter 3.413333<BR>vertical pixels per millimeter 3.413333<BR>horizontal pixels per inch 86.698667<BR>vertical pixels per inch 86.698667</DIV>
<DIV> </DIV>
<DIV>I tried to run this program on the Dell M4300 system at 1920x1200, but I'm running into some stupid Microsoft problem. I installed the VC_Redist, but it still doesn't work on this system. Not sure what is wrong yet.</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy<BR><BR>>>> Jay <jayk123@hotmail.com> 8/5/2008 9:01 AM >>><BR><BR><BR>Randy, I'm pretty clueless here.<BR>I don't do gui or graphics.<BR>If anyone has a clue, please stand up.<BR>If you can get us code to run, please do.<BR>But I think I need multiple particularly configured machines too.<BR><BR>I'm curious what this code prints on the systems:<BR><BR>#include<BR>#include<BR><BR>int main()<BR>{<BR>int pix_ver = { 0 };<BR>int pix_hor = { 0 };<BR>int mm_hor = { 0 };<BR>int mm_ver = { 0 };<BR>HWND hwnd = { 0 };<BR>HDC hdc = { 0 };<BR><BR>hwnd = GetDesktopWindow();<BR>hdc = GetDC(hwnd);<BR>mm_hor = GetDeviceCaps(hdc, HORZSIZE);<BR>mm_ver = GetDeviceCaps(hdc, VERTSIZE);<BR>pix_hor = GetSystemMetrics(SM_CXSCREEN);<BR>pix_ver = GetSystemMetrics(SM_CYSCREEN);<BR><BR>printf("horizonal pixels %d\n", pix_hor);<BR>printf("veritical pixels SM_CYSCREEN %d\n", pix_ver);<BR>printf("horizontal millimeters %d\n", mm_hor);<BR>printf("veritical millimeters %d\n", mm_ver);<BR><BR>printf("horizontal pixels per millimeter %f\n", (((float) pix_hor) / ((float) mm_hor)));<BR>printf("vertical pixels per millimeter %f\n", (((float) pix_ver) / ((float) mm_ver)));<BR><BR>printf("horizontal pixels per inch %f\n", (((float) pix_hor) / ((float) mm_hor) * 10.0 * 2.54));<BR>printf("vertical pixels per inch %f\n", (((float) pix_ver) / ((float) mm_ver) * 10.0 * 2.54));<BR><BR>return 0;<BR>}<BR><BR><BR>for me:<BR><BR>$ gcc dpi.c -luser32 -lgdi32<BR><BR>jay@jay-win9 /dev2/j/dpi<BR>$ ./a<BR>horizonal pixels 1280<BR>veritical pixels SM_CYSCREEN 800<BR>horizontal millimeters 384<BR>veritical millimeters 240<BR>horizontal pixels per millimeter 3.333333<BR>vertical pixels per millimeter 3.333333<BR>horizontal pixels per inch 84.666667<BR>vertical pixels per inch 84.666667<BR><BR>(Visual C++ is fine:<BR>cl dpi.c user32.lib gdi32.lib<BR>.\dpi<BR>)<BR><BR>I wonder if lying in this code:<BR><BR>Searching for 'GetDeviceCaps'...<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(25): VAR res := NEW(T); n_colors := GetDeviceCaps (WinGDI.NUMCOLORS);<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(32): res.depth := GetDeviceCaps(WinGDI.BITSPIXEL); (* John Karnak 8/3/98 *)<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(68): mm_hor = GetDeviceCaps (WinGDI.HORZSIZE),<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(69): mm_ver = GetDeviceCaps (WinGDI.VERTSIZE) DO<BR><BR>Searching for 'res.res[Axis.T.'...<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(71): res.res[Axis.T.Hor] := FLOAT(pix_hor) / FLOAT(mm_hor);<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(72): res.res[Axis.T.Ver] := FLOAT(pix_ver) / FLOAT(mm_ver);<BR><BR><BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(89):PROCEDURE GetDeviceCaps (cap: Ctypes.int): INTEGER =<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(93): res := WinGDI.GetDeviceCaps (hdc, cap);<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScreenType.m3(98): END GetDeviceCaps;<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScrnColorMap.m3(268): cnt := WinGDI.GetDeviceCaps (hdc, WinGDI.NUMCOLORS);<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScrnFont.m3(316): LogicalPixelsPerVertInch := WinGDI.GetDeviceCaps(er.hdc, WinGDI.LOGPIXELSY);<BR>9 occurrence(s) have been found.<BR><BR><BR>Searching for '1000.0'...<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScrnPixmap.m3(463): bmih.biXPelsPerMeter := ROUND (st.res[Axis.T.Hor] * 1000.0);<BR>D:\dev2\cm3.2\m3-ui\ui\src\winvbt\WinScrnPixmap.m3(464): bmih.biYPelsPerMeter := ROUND (st.res[Axis.T.Ver] * 1000.0);<BR><BR><BR>and just claiming 96dpi is the way to go.<BR>Can you try that??<BR><BR><BR>Specifically try setting res.res[Axis.T.Hor] and .Ver to 3.779527559055118.<BR>Or heck to 3.3333 like my laptop has.<BR><BR><BR>Or maybe claiming ignorance and setting biXPelsPerMeter and biYPelsPerMeter to 0???<BR>Claiming ignorance feels better than lying of course. :)<BR><BR>Hm, so throw in also:<BR><BR>printf("LogicalPixelsX %u\n", GetDeviceCaps(hdc, LOGPIXELSX));<BR>printf("LogicalPixelsY %u\n", GetDeviceCaps(hdc, LOGPIXELSY));<BR><BR>I get the magic number 96.<BR><BR>- Jay<BR></DIV></BODY></HTML>