Visual Studio MFC MDI, CRichEditDoc or CRichEditView get file path

  • Thread starter Thread starter gsegria
  • Start date Start date
G

gsegria

Guest
I created a MFC MDI application with CRichEditView .

I want to get current file path when i open a txt file.

But i get file path on Serialize , that is failed.

The Path is "". No any file path.


========================

Here is my sample code:

========================

void CMyEditDoc::Serialize(CArchive& ar)
{
CFile* pFile = ar.GetFile();
CString Path = pFile->GetFilePath(); // failed to get file path

if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}

// Calling the base class CRichEditDoc enables serialization
// of the container document's COleClientItem objects.
// TODO: set CRichEditDoc::m_bRTF = FALSE if you are serializing as text

CRichEditDoc::Serialize(ar);
}

Continue reading...
 
Back
Top