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 prevent copying a file

How to prevent copying a file

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
6 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.
  • N Offline
    N Offline
    nps_ltv
    wrote on last edited by
    #1

    In an Visual C++ 6.0 application, I need to prevent copying the specified file to other directory, but I don't know how to do. Please help me!!! Thank you very much! P.S. If maybe, you can demonstrate an small application about this. Thank you!

    M D 2 Replies Last reply
    0
    • N nps_ltv

      In an Visual C++ 6.0 application, I need to prevent copying the specified file to other directory, but I don't know how to do. Please help me!!! Thank you very much! P.S. If maybe, you can demonstrate an small application about this. Thank you!

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      Prevent who ? You could open the file with CFile and use one of the flag to prevent other processed to access it.


      Maximilien Lincourt Your Head A Splode - Strong Bad

      1 Reply Last reply
      0
      • N nps_ltv

        In an Visual C++ 6.0 application, I need to prevent copying the specified file to other directory, but I don't know how to do. Please help me!!! Thank you very much! P.S. If maybe, you can demonstrate an small application about this. Thank you!

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

        You would need to set this restriction at the OS level.


        "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

        C 1 Reply Last reply
        0
        • D David Crow

          You would need to set this restriction at the OS level.


          "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

          C Offline
          C Offline
          carrivick
          wrote on last edited by
          #4

          Create a service which opens an exclusive handle to the file. This will prevent copying and deleting.

          N 1 Reply Last reply
          0
          • C carrivick

            Create a service which opens an exclusive handle to the file. This will prevent copying and deleting.

            N Offline
            N Offline
            nps_ltv
            wrote on last edited by
            #5

            If maybe, you can demonstrate how you do it? Because, I don't still understand you. Can you help me!!! Please!!! Thank you very much!

            C 1 Reply Last reply
            0
            • N nps_ltv

              If maybe, you can demonstrate how you do it? Because, I don't still understand you. Can you help me!!! Please!!! Thank you very much!

              C Offline
              C Offline
              carrivick
              wrote on last edited by
              #6

              Using the mfc CFile class CString file_name = _T("C:\\AnotherFile"); CFile f; f.Open( file_name, CFile::modeRead | CFile::shareExclusive ); while(1) Sleep(1000);

              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