Page 1 of 1

Page width difference between XP and 98

Posted: Thu Jun 16, 2005 11:34 pm
by ken66
I have attached another test app that draws a thick line from the left edge of the page to the right edge of the page. On Win 98, the line is drawn all the way from edge to edge. On Win XP, the line is not drawn clear to the edge. Is there a way to force these to match?

Also, GetDeviceCaps() with the parameter of VERTRES and HORZRES should return the width and height of the page in pixels (I believe). HORZRES should be the equivalent of 8.5 * GetDeviceCaps(LOGPIXELSX) and VERTRES should be the equivalent of 11 *
GetDeviceCaps(LOGPIXELSY). At least this is my understanding. However, HORZRES and VERTRES seem to be returning the resolution of from display settings.

Thanks for you time and help.

Posted: Fri Jun 17, 2005 9:44 am
by John - Tracker Supp
Hi Ken,

Please see the attached zip and the files files test_me.pdf and test_xp.pdf, as you can see the differences we see here are minor and these are beyond our control - down to the different OS's and the way the Metafiles are created I am afraid (during ContentDC/ReleaseContentDC)

The metafiles created are different - hence the slight variation in output.

With regards HORZRES and VERTRES, again, down to the management of the DC for each OS and it returns all values for use.

Posted: Fri Jun 17, 2005 3:57 pm
by ken66
Here is the difference I am seeing between win 98 and win xp. XP has a much larger difference than what you are seeing. I have never seen a difference like this on different os's. It seems odd the XP system is the one in question.

The system is an XP professional service pack 2. Running on a Dell 610 laptop.

Posted: Sat Jun 18, 2005 8:13 am
by John - Tracker Supp
Is this result as an example of the same code posted earlier or has this changed ?

If not - please alter your code to use the previously detailed mapping mode "HIMETRIC" and the difference in output will be much less dramatic as in the files uploaded by me.

Posted: Mon Jun 20, 2005 3:58 pm
by ken66
These PDF files are from the code I posted earlier in this thread.

I do not understand why I need to change my code to use HIMETRIC. If I use the functions dc.GetDeviceCaps(LOGPIXELSX) and dc.GetDeviceCaps(LOGPIXELSY) to get the number of pixels per inch, this should be the same from OS to OS. We have an application that currently does everything this way and it works on all Microsoft OS's. We would rather not have to change all our code to HIMETRIC since this code is working for us. I am assuming that if I can use the hDC I get from PXC_GetContentDC() just like I would use a DC in my windows application.

Posted: Mon Jun 20, 2005 5:27 pm
by John - Tracker Supp
You are wrong in your assumption that the result should be the same from one OS to another,- especially true when dealing with metafiles - we work with these every day and I can assure that a considerable amount of our time is taken up working around this very issue:

Try this sample code in both Win9x and XP :

HDC dc = ::GetDC(NULL);
int or_dc_lpx = GetDeviceCaps(dc, LOGPIXELSX);
int or_dc_lpy = GetDeviceCaps(dc, LOGPIXELSY);
RECT metarect;
metarect.left = = 0;
metarect.right = 8 * 2540 / 72;
metarect.bottom = 11 * 2540 / 72;
HDC metadc = CreateEnhMetaFile(dc, NULL, &metarect, NULL);
int meta_dc_lpx = GetDeviceCaps(metadc, LOGPIXELSX);
int meta_dc_lpy = GetDeviceCaps(metadc, LOGPIXELSY);

Are there any differences between or_dc_lpx and meta_dc_lpx values ?
metadc and dc have different contents but the returned values are the SAME!

With respect questions such as : "I do not understand why I need to change my code to use HIMETRIC" should be directed at Microsoft support, but not us.

Trying to help you resolve a compatibility issue here between 2 MS products - but you are making it very hard to do so. I appreciate it is inconvenient - but we have to do it almost daily and I am afraid if you want a satisfactory result - you will, in this instance, have to do the same.

Posted: Mon Jun 20, 2005 6:04 pm
by ken66
I didn't intend to be difficult. I'm sorry it came across this way. I just wanted to understand why. I am used to the Printer DC giving me a pixels per inch which works on all OSs.

Sorry for bothering you

Posted: Mon Jun 20, 2005 6:13 pm
by John - Tracker Supp
No problem Ken,

but I promise we would not suggest you to do something or advise it was necessary - were it not so ;)

Good luck !