Microsoft KB Archive/328698

= The print preview behavior in Visual C++ .NET or in Visual C++ 2005 =

Article ID: 328698

Article Last Modified on 1/5/2006

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-



This article was previously published under Q328698



SUMMARY
In Visual C++ .NET or in Visual C++ 2005, print preview always appears in the Multiple-Document Interface (MDI) frame window.



MORE INFORMATION
The following code is from Microsoft Foundation Classes (MFC) source code of Visual C++ .NET or of Visual C++ 2005:

BOOL CView::DoPrintPreview(UINT nIDResource, CView* pPrintView,  CRuntimeClass* pPreviewViewClass, CPrintPreviewState* pState) {      ...    CWnd* pMainWnd = GetParentFrame; if (DYNAMIC_DOWNCAST(CFrameWnd, pMainWnd) == NULL) {       // If it is not a frame, try the main window. pMainWnd = AfxGetMainWnd; }

CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, pMainWnd); ASSERT_VALID(pParent); Note You must add the common language runtime support compiler option (/clr:oldSyntax) in Visual C++ 2005 to successfully compile the previous code sample. To add the common language runtime support compiler option in Visual C++ 2005, follow these steps:
 * 1) Click Project, and then click   Properties.

Note  is a placeholder for the name of the project.
 * 1) Expand Configuration Properties, and then click General.
 * 2) Click to select Common Language Runtime Support, Old Syntax (/clr:oldSyntax) in the Common Language Runtime support project setting in the right pane, click Apply, and then click OK.

For more information about the common language runtime support compiler option, visit the following Microsoft Web site:

/clr (Common Language Runtime Compilation)

http://msdn2.microsoft.com/en-us/library/k8d11d4s.aspx

