Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Saving before close

Saving before close

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    doctorpi
    wrote on last edited by
    #1

    Hi guys I'd like to ask the user to save his Doc before exit in my SDI app and then do like he pressed the Save button in menu. Where I have to do the call, and how? Best Regards Doc

    D O S 3 Replies Last reply
    0
    • D doctorpi

      Hi guys I'd like to ask the user to save his Doc before exit in my SDI app and then do like he pressed the Save button in menu. Where I have to do the call, and how? Best Regards Doc

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      With a "normal" SDI app, everything is already in place. If the document's data is serializable, put your code in the Serialize() method. Otherwise, put your code in the OnSaveDocument() method.


      Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

      1 Reply Last reply
      0
      • D doctorpi

        Hi guys I'd like to ask the user to save his Doc before exit in my SDI app and then do like he pressed the Save button in menu. Where I have to do the call, and how? Best Regards Doc

        O Offline
        O Offline
        Obliterator
        wrote on last edited by
        #3

        You need to monitor when the user has made a change in the document which you count as significant enough to require saving. For example the user updated a text box on your form, or drew a circle, or whatever. When that happens you must call the SetModifiedFlag(TRUE) method of your document class. The framework will then automatically prompt the user to save the document if they close the window. Of course you still need to add code in OnSaveDocument or Serialize to actually do the work of saving to a file just as the previous user indicated. Hope it helps... -- The Obliterator

        1 Reply Last reply
        0
        • D doctorpi

          Hi guys I'd like to ask the user to save his Doc before exit in my SDI app and then do like he pressed the Save button in menu. Where I have to do the call, and how? Best Regards Doc

          S Offline
          S Offline
          Stye
          wrote on last edited by
          #4

          At some point use SetModifiedFlag(TRUE) and before closing have SaveModified() in the code.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups