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 generated reports but I find soem problem in the new View
class CMyHtmlView : public CHtmlView
{
protected: // create from serialization only
CMyHtmlView();
DECLARE_DYNCREATE(CMyHtmlView)
// Attributes
public:
CReportDoc* GetDocument();
CString m_sFileName;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyHtmlView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual void OnFilePrintPreview();
virtual void OnFilePrint();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyHtmlView();
//{{AFX_MSG(CMyHtmlView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
void CMyHtmlView::OnFilePrintPreview()
{
// Before this I will call a Function Generate a HTML File in a Location and Updated in m_sFileName
Navigate2(m_sFileName);
ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER, NULL, NULL );
}
void CMyHtmlView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
Navigate2(_T("about:blank"));
}
void CMyHtmlView::OnFilePrint()
{
// Before this I will call a Function Generate a HTML File in a Location and Updated in m_sFileName
Navigate2(m_sFileName,NULL,NULL);
CHtmlView::OnFilePrint();
}
In this Printing OnFilePrint() is working without any problem. But the problem exists in the OnFilePrintPreview().
Here is the problem:
On Calling ExecWB() after a Navigate() makes only the HTML view based Window in the App, no print preview window been shown
Am I doing anything wrong?