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. How to know if a document is open/changed?

How to know if a document is open/changed?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
7 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.
  • P Offline
    P Offline
    PravinSingh
    wrote on last edited by
    #1

    From my application I am opening a document (could be Word, pdf, anything) using ShellExecute(). Now how can I check whether: (i) The document is still open. (ii) Some unsaved changes are made to that document. We can not watch a directory for changes because that will work only when changes are saved to documents or new documents are created.


    It's better to know some of the questions than all of the answers.
    Pravin.

    D 1 Reply Last reply
    0
    • P PravinSingh

      From my application I am opening a document (could be Word, pdf, anything) using ShellExecute(). Now how can I check whether: (i) The document is still open. (ii) Some unsaved changes are made to that document. We can not watch a directory for changes because that will work only when changes are saved to documents or new documents are created.


      It's better to know some of the questions than all of the answers.
      Pravin.

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

      PravinSingh wrote:

      (i) The document is still open.

      You can't. You can, however, know if the application itself is still open.

      PravinSingh wrote:

      (ii) Some unsaved changes are made to that document.

      Not possible that I know of.

      PravinSingh wrote:

      We can not watch a directory for changes because that will work only when changes are saved to documents or new documents are created.

      So unless those changes are committed to disk, why worry about them?


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      P 1 Reply Last reply
      0
      • D David Crow

        PravinSingh wrote:

        (i) The document is still open.

        You can't. You can, however, know if the application itself is still open.

        PravinSingh wrote:

        (ii) Some unsaved changes are made to that document.

        Not possible that I know of.

        PravinSingh wrote:

        We can not watch a directory for changes because that will work only when changes are saved to documents or new documents are created.

        So unless those changes are committed to disk, why worry about them?


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        P Offline
        P Offline
        PravinSingh
        wrote on last edited by
        #3

        DavidCrow wrote:

        So unless those changes are committed to disk, why worry about them?

        In my applicaltion I have a record with an attached document (which I am opening with ShellExecute). Before navigating away from this record, I want to warn the user of any unsaved changes in the attached document.


        It's better to know some of the questions than all of the answers.
        Pravin.

        L 1 Reply Last reply
        0
        • P PravinSingh

          DavidCrow wrote:

          So unless those changes are committed to disk, why worry about them?

          In my applicaltion I have a record with an attached document (which I am opening with ShellExecute). Before navigating away from this record, I want to warn the user of any unsaved changes in the attached document.


          It's better to know some of the questions than all of the answers.
          Pravin.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          What are you trying to do, some sort of work-flow application? If so you are going about it the wrong way, operating on assumptions that are unfounded. Try doing some research on whatever problem you are trying to solve and see what knowledge the industry has that might be of help to you.

          S 1 Reply Last reply
          0
          • L led mike

            What are you trying to do, some sort of work-flow application? If so you are going about it the wrong way, operating on assumptions that are unfounded. Try doing some research on whatever problem you are trying to solve and see what knowledge the industry has that might be of help to you.

            S Offline
            S Offline
            sudheee
            wrote on last edited by
            #5

            [Message Deleted]

            L D 2 Replies Last reply
            0
            • S sudheee

              [Message Deleted]

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              sudheee wrote:

              if its not working i am sorry.

              You must be a manager

              1 Reply Last reply
              0
              • S sudheee

                [Message Deleted]

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

                sudheee wrote:

                by tracking the position of the file pointer u can find whether the opened document have unsaved changes or not.

                I'm going to give you the benefit of the doubt and assume you are kidding. Tracking whether a file has changed by looking at the file pointer is not even a remote possibility. :rolleyes:


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                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