Modify CMy1stEditDoc:: OnOpenDocument() and OnNewDocument()
In this step, we continue to modify functions. Still in 1stEditDoc.cpp, edit
BOOL CMy1stEditDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
m_Edit.SetLanguage(_T("DevStudio"));
return (m_Edit.ReadFile(lpszPathName));
}
BOOL CMy1stEditDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
m_Edit.SetLanguage(_T("DevStudio"));
m_Edit.Init();
return TRUE;
}
In the OnNewDocument() override, calling SetLanguage() before calling Init() is recommended.