First, please make sure your class is declared as follows
class CYourView : public CExtPPVW < CView >
The
CExtPPVW < CView >
template based class in this case is derived from both
CView
class and
CExtPPVW_Printable
. The latter one provides a set of virtual methods for handling printing events like in MFC views. But signatures of
OnEndPrintPreview()
methods in these two classes are different
void CView::OnEndPrintPreview(
CDC * pDC,
CPrintInfo * pInfo,
POINT,
CPreviewView * pView
)
void CExtPPVW_Printable::OnEndPrintPreview(
CDC * pDC,
CPrintInfo * pInfo,
POINT point,
CExtPPVW_HostWnd * pWndPrintPreviewHost
)
Unfortunately we cannot use the
CView::OnEndPrintPreview()
signature because
CExtPPVW
provides the printing and print preview feature not only for MFC views. So make sure you are using the signature of
CExtPPVW_Printable::OnEndPrintPreview()
.
Then find the
CDrawView
class in the
DRAWCLI sample. It represents an MFC view window based on printing and print preview subsystem provided by Prof-UIS. If you add the following method into declaration of this class, then you will see a message box each time you exits the print preview mode.
void OnEndPrintPreview(
CDC * pDC,
CPrintInfo * pInfo,
POINT point,
CExtPPVW_HostWnd * pWndPrintPreviewHost
)
{
CExtPPVW_Printable::OnEndPrintPreview(
pDC,
pInfo,
point,
pWndPrintPreviewHost
);
::AfxMessageBox( _T("Print preview mode is off.") );
}