The information in this article applies to:
SYMPTOMSWhen you display Print Preview for a Multiple Document Interface (MDI) application, depending on the version of Microsoft Foundations Classes (MFC) you are using, it may appear either in the MDI child frame or in the MDI main frame. For Visual C++ 4.2b, it is further dependent on whether you have a splitter window or not. CAUSEThe preview window was moved to the MDI child window to support ActiveX documents. However, it was later decided that keeping it in the MDI main frame window was the better design choice. RESOLUTIONStatically link to the MFC libraries (modified or unmodified) or design your preview function using the latest behavior in Visual C++ 6.0. STATUS
Microsoft has confirmed this to be a bug only in the MFC libraries in Visual C++ 4.2b and 5.0. MORE INFORMATIONWhen MFC's Print Preview is invoked, it searches for the frame window of the current view using GetParentFrame to display the preview view. This is done in CView::DoPrintPreview. The code below reflects some of the changes that DoPrintPreview went through between Visual C++ versions 4.2 and 6.0: Visual C++ 4.2In Visual C++ 4.2, Print Previews always appear in the MDI frame window. This was the original behavior.
Visual C++ 4.2bIn Visual C++ 4.2b, Print Preview was moved to the MDI child frame to support Active Documents. However, it appears in the MDI frame window only when the parent of the view is not a CFrameWnd-derived object (such as a splitter window). This inconsistency was considered a bug and was fixed in Visual C++ 5.0.
Visual C++ 5.0In VC 5.0, Print Preview always appears within the MDI child window. (This was the intended "feature" in Visual C++ 4.2b.)
Visual C++ 6.0For Visual C++ 6.0, Microsoft decided that Print Preview belongs in the MDI main frame window, so its behavior was changed back. (The Visual C++ 5.0 "feature" was considered a bug.)
To change the behavior of Print Preview in any of the versions, you have to modify the MFC sources and rebuild the
MFC libraries. It is not possible to override DoPrintPreview in your CView-derived class because it requires the use of protected members of friend classes.The best design approach is to write your application using the behavior where Print Preview appears within the MDI main frame window. This is the current behavior of MFC. © Microsoft Corporation 1999, All Rights Reserved. Additional query words:
Keywords : kbcode kbui kbDocView kbMFC kbPrinting KbUIDesign kbVC kbVC420bug kbVC500bug kbVC600fix kbGrpMFCATL |
Last Reviewed: September 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |