I would like to have multiple views for a document in my MDI MFC application. In order to do that, InitInstance of my App class has following code
m_pMainTemplate = new CMultiDocTemplate(IDR_OpenCVTestTYPE,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CImageView));
if (!m_pMainTemplate)
return FALSE;
AddDocTemplate(m_pMainTemplate);
m_pHistTemplate = new CMultiDocTemplate(IDR_OpenCVTestTYPE,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CHistogramView));
if (!m_pHistTemplate)
return FALSE;
AddDocTemplate(m_pHistTemplate);
But when I start the application, it keeps asking which document among two documents user wants to choose. Of course, those documents are the same kind. Any idea or hint to resolve this problem?
UPDATE: I resolved the problem by having separate menu for the second view and overriding OnFileNew like this
void CMyApp::OnFileNew()
{
// TODO: Add your command handler code here
m_pMainTemplate->OpenDocumentFile(NULL);
}