Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help on getting document paths in SDI

Status
Not open for further replies.

cppnewbie

Programmer
Feb 7, 2003
1
US
So i have an SDI program that acts as a text editor. Just a program made from the appwizard. The problem is, how do i get the path where the document has been saved?
 
If You wish to know it only, it is easy: in Function CYourDoc::Serialize(CArchive& ar) You can get the Path+Name from ar.m_pFile->m_strFileName by saving.
After saving (not in Serialize()!) the Path and Name are in m_strPathName - Member of CYourDoc (it is the Class that appwizard has created for You).

If You wish change the name, it is not so easy - You must override for example BOOL CYourDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) Member.
 
1. If you open the document with the app you made then you can pull it from where you opened it.

I dont think this is where the problem is though. I would assume that you "save" the document with the app and need to save it again? If that is the case you can keep track of the path with the app. You can do this with a class or as mentioned above.

What I would also look into is CFileDialog which provides an easy interface to open and save/save as.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top