Preview window closes when print button is clicked in print previe
Hi All,
I am facing a problem with print preview, but i want to know whether it is
expected behavior or problem.
In our application we are customizing the print preview toolbar. In which we
are handling all the events except print, print in the preview window is
directly handled by the MFC class CPreviewView::OnPreviewPrint function.
Whenever we click the print button it closes the preview window and sends
command for printing. But here i want the preview window should not close
when print is given.
This is the code of OnPreviewPrint function in VIEWPRIV.CPP MFC filewhich
handles the print event in print preview window
void CPreviewView::OnPreviewPrint()
{
OnPreviewClose(); // force close of Preview
// cause print (can be overridden by catching the command)
CWnd* pMainWnd = AfxGetThread()->m_pMainWnd;
ASSERT_VALID(pMainWnd);
pMainWnd->SendMessage(WM_COMMAND, ID_FILE_PRINT);
}
Actually the OnPreviewPrint() function is like this, first closing the
Preview and sending the print command. Now is that possible to customize this
function and is it possible to stop the preview window closing when we give
print in the print preview window.
Thanks,
Pradeep