Jun Du wrote:
- Your app overrides OpenDocumentFile() so that it displays any views beside the default.
Yes, this is done. When I open an existing document (and ONLY then), both views appear and work correctly. It is done this way (just like the sample): CDocument* CSequApp::OpenDocumentFile(LPCTSTR lpszFileName) { CSequDoc* pDoc = (CSequDoc*) CWinApp::OpenDocumentFile(lpszFileName); if (pDoc == NULL) return NULL; CFrameWnd* pNewFrame = m_pEditorTemplate->CreateNewFrame(pDoc, NULL); if (pNewFrame == NULL) return pDoc; m_pEditorTemplate->InitialUpdateFrame(pNewFrame, pDoc); }
Jun Du wrote:
- Let your app to handle file-new command, and call the overriden OpenDocumentFile() in the command handler.
At present, I have this in the message map: ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
If I understand you correctly, I should change it to... ON_COMMAND(ID_FILE_NEW, OnFileNew)
...and then define the OnFileNew function: void CSequApp::OnFileNew() { CWinApp::OnFileNew(); ... (some call to OpenDocumentFile()) }
Is this right? In that case, what's the code I have to add there? I don't think I'll get it right myself...