BUG: Win95 GDI Resets Window/ViewportOrg in MM_TEXT Mode

Last reviewed: June 11, 1996
Article ID: Q152236
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) for Windows 95, versions 3.1, 4.0

SYMPTOMS

An application marked as 3.1 will have its window origin and viewport origin reset on Windows 95 when StartPage() is called and the device context (DC) is in the MM_TEXT mapping mode.

This is a problem only in Windows 95 for both 16-bit and 32-bit applications marked as 3.1.

CAUSE

This bug occurs when enhanced metafiles (EMF) are used to print in Windows 95.

In Windows 95, all output to a non-Postsript printer spools as EMFs. While EMF spooling or EMF banding, GDI fails to record the window or viewport origins unless the mapping mode is set to something other than MM_TEXT.

This problem should not occur when printing to Postscript printers, because these printers do not support spooling using EMFs.

RESOLUTION

The best way to work around this behavior is to call StartPage() before changing any DC attributes. Doing this guarantees that the DC attributes do not get reset regardless of the operating system or whether the application is marked 3.1 or 4.0.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

When an application prints, Windows 95 directs all GDI output calls for a page to an ENHANCED metafile. When EndPage is called, GDI steps through the bands on the page and plays the metafile into every band. In Windows 95, GDI fails to record the origin and extent information into the metafile unless the mapping mode is set to something other than MM_TEXT.

In Windows 95, StartPage resets the printer DC attributes for 4.0-marked applications, while 3.1-marked applications do not reset the printer DC attributes until EndPage is called. Windows NT 3.x does not reset printer DC attributes at all during a print job. For more information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE ID: Q125696
   TITLE     : StartPage/EndPage Resets Printer DC Attributes in Windows 95


Additional reference words: 3.10 4.00 SetWindowOrg SetViewportOrg
KBCategory: kbgraphic kbbuglist
KBSubcategory: GdiDC



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 11, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.