<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>Ok, I solved the Microsoft problem.</DIV>
<DIV> </DIV>
<DIV>Here are the results on Dell M4300 at 1920x1200:</DIV>
<DIV> </DIV>
<DIV>horizonal pixels 1920<BR>veritical pixels SM_CYSCREEN 1200<BR>horizontal millimeters 330<BR>veritical millimeters 206<BR>horizontal pixels per millimeter 5.818182<BR>vertical pixels per millimeter 5.825243<BR>horizontal pixels per inch 147.781818<BR>vertical pixels per inch 147.961165<BR></DIV>
<DIV>Wow!  these numbers are radically different than the IBM T60 at 1280x1024:</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<BR></DIV>
<DIV>Now, if you look at the Windows dpi setting for the 1920x1200 machine, it says 96dpi, but this is in the General tab of the Display properties Advanced settings.  I suspect this is just the dpi setting applied to fonts.</DIV>
<DIV> </DIV>
<DIV>I tried plugging the numbers into Image.i3 as suggested by Daniel:</DIV>
<DIV>TYPE<BR>  Raw = OBJECT<BR>      width, height: INTEGER;<BR>      xres: REAL := 147.781818; (* in pixels per inch *)<BR>      yres: REAL := 147.961165; (* in pixels per inch *)<BR>    METHODS<BR>      get (h, v: INTEGER): Pixel;<BR>      set (h, v: INTEGER; pixel: Pixel);<BR>    END;<BR></DIV>
<DIV>When I do this, my pixmaps look correct on the 1920x1200 display!!!!!</DIV>
<DIV> </DIV>
<DIV>Now, the problem I am faced with is how to come up with a way that the code will work on any type of monitor.  I can't edit Image.i3 for every resolution and produce a different binary.  Any ideas?</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy</DIV>
<DIV><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>