I have a MFC MDI app, with tabbed childs.
And I want to change the title of the document and tab, after the document is loaded. And I noticed that CDocument::SetTitle is working on OnNewDocument, but not from OnOpenDocument:
BOOL CMyDoc::OnNewDocument()
{
if (! CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
SetTitle(_T("AAA")); // working
return TRUE;
}
BOOL CMyDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (! CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized code here and/or call the base class
SetTitle(_T("BBBB")); // not working
return TRUE;
}
How can I solve that ?