none
MFC Document/View - serialize??? RRS feed

  • Question

  • How do I control what happens when the user saves the file while using document/view architecture. That is, I don't want the file to be erased when the save command is executed.

    Monday, June 30, 2008 8:18 AM

Answers

  • Hi,

    By default, when you click the "File > Save" menu item, the “Serialize” function of the active frame's document class  will be called( For example, if you create a SDI application named "SDI", then"CSDIDoc::Serialize" is called). You can open "$(VCInstallDir)atlmfc\src\mfc\doccore.cpp"($(VCInstallDir) represents the installed directory of Visual C++), set a breakpoint in "CDocument::OnFileSave" and then debug your program to trace the action of file saving process.

    What do you mean "don't want the file to be erased?" Do you mean "Keep the opened file unchanged even if you change its conetent"? Would you please elaborate this?

    Thanks!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Yan-Fei Wei Sunday, July 6, 2008 3:38 AM
    Wednesday, July 2, 2008 7:20 AM

All replies

  • Hi,

    By default, when you click the "File > Save" menu item, the “Serialize” function of the active frame's document class  will be called( For example, if you create a SDI application named "SDI", then"CSDIDoc::Serialize" is called). You can open "$(VCInstallDir)atlmfc\src\mfc\doccore.cpp"($(VCInstallDir) represents the installed directory of Visual C++), set a breakpoint in "CDocument::OnFileSave" and then debug your program to trace the action of file saving process.

    What do you mean "don't want the file to be erased?" Do you mean "Keep the opened file unchanged even if you change its conetent"? Would you please elaborate this?

    Thanks!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Yan-Fei Wei Sunday, July 6, 2008 3:38 AM
    Wednesday, July 2, 2008 7:20 AM
  • Hello

    Re:  MFC Document/View - serialize???

    I am going to mark this thread as answered since you have not followed up with any further information on your problem as requested - I assume you solved the problem yourself or one of the suggestions in this thread helped you solved the problem. If you have a solution you could post it so others can find it. If you don’t have a solution, then please submit further details and then mark the thread as unanswered.

    Thanks!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Sunday, July 6, 2008 3:38 AM