MFC: How to get name of file opened
-
I have created a single document application with MFC wizard. I want to capture file name being opened when user selects a file and opens it through the file open dialog box. How can I do this? Thanks
CDocument::GetPathName() after document is opened You can override CDocument::OnOpenDocument() to do the open--I've done this many, many times. (I suggest overriding this, calling the base class, then stepping through the code to understand what the base class is doing [with dirty flags and all that.]) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
CDocument::GetPathName() after document is opened You can override CDocument::OnOpenDocument() to do the open--I've done this many, many times. (I suggest overriding this, calling the base class, then stepping through the code to understand what the base class is doing [with dirty flags and all that.]) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke