This is Linking to my previous question.
I have managed to make a new view derived from the CHtmlView
for the new type of View for the my application generat
I found out a way to end the problem with Print and Print Preview after Navigate(). As user1793036 mentioned it is an asynchrous call and I need to wait for that operation to complete. This is the reason that the Print Preview and Print is loading an empty page.
I found the event OnNavigateComplete2() and overridden as below for the hassle free Print/preview operations.
void CMyHtmlView::OnNavigateComplete2(LPCTSTR strURL)
{
if(m_ePrintMode == PREVIEW)
ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER, NULL, NULL );
else if(m_ePrintMode == PRINT)
CHtmlView::OnFilePrint();
else
return;
}
And modified my Print and Print Preview events as
void CMyHtmlView::OnFilePrintPreview()
{
OnSaveHtmlReport();
m_ePrintMode = PREVIEW; // an Enum
Navigate2(m_sFileName);
}
void CMyHtmlView::OnFilePrint()
{
OnSaveHtmlReport();
m_ePrintMode = PRINT; // an Enum
Navigate2(m_sFileName,NULL,NULL);
}