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 hide a file (any file)?

How to hide a file (any file)?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
8 Posts 3 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.
  • J Offline
    J Offline
    john_tran
    wrote on last edited by
    #1

    i want to write a program by C++ , that it will hide a file so that noone can see this file in the directory. What techonology of this i need to learn to do it by myself? Thanks Ask More - Learn More JohnJone

    J D 2 Replies Last reply
    0
    • J john_tran

      i want to write a program by C++ , that it will hide a file so that noone can see this file in the directory. What techonology of this i need to learn to do it by myself? Thanks Ask More - Learn More JohnJone

      J Offline
      J Offline
      jan larsen
      wrote on last edited by
      #2

      :-)

      HANDLE hFile;
      TCHAR fileName = TEXT("C:\\myfile.txt");

      hFile = CreateFile(
      fileName,
      GENERIC_WRITE,
      FILE_SHARE_READ,
      NULL,
      CREATE_NEW,
      FILE_ATTRIBUTE_HIDDEN,
      NULL);

      "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

      J 1 Reply Last reply
      0
      • J john_tran

        i want to write a program by C++ , that it will hide a file so that noone can see this file in the directory. What techonology of this i need to learn to do it by myself? Thanks Ask More - Learn More JohnJone

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

        john_tran wrote: What techonology of this i need to learn to do it by myself? How about SetFileAttributes()?


        "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

        1 Reply Last reply
        0
        • J jan larsen

          :-)

          HANDLE hFile;
          TCHAR fileName = TEXT("C:\\myfile.txt");

          hFile = CreateFile(
          fileName,
          GENERIC_WRITE,
          FILE_SHARE_READ,
          NULL,
          CREATE_NEW,
          FILE_ATTRIBUTE_HIDDEN,
          NULL);

          "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

          J Offline
          J Offline
          john_tran
          wrote on last edited by
          #4

          i know what you means. But i want to know other tech. Because if we set the file's attribute is "hide", user can easily unhide if they choose folder option/and choose unhide in windows. I mean that i will hide all time even user set view unhide file. And just my program can set unhide attribute to the file only. Ask More - Learn More JohnJone

          J 1 Reply Last reply
          0
          • J john_tran

            i know what you means. But i want to know other tech. Because if we set the file's attribute is "hide", user can easily unhide if they choose folder option/and choose unhide in windows. I mean that i will hide all time even user set view unhide file. And just my program can set unhide attribute to the file only. Ask More - Learn More JohnJone

            J Offline
            J Offline
            jan larsen
            wrote on last edited by
            #5

            Ah, well, then the answer is simple. It's just not possible :-) "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

            J 1 Reply Last reply
            0
            • J jan larsen

              Ah, well, then the answer is simple. It's just not possible :-) "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

              J Offline
              J Offline
              john_tran
              wrote on last edited by
              #6

              Oh, i see some application can do that. But i dont know how they do that, what technology they use.

              J 2 Replies Last reply
              0
              • J john_tran

                Oh, i see some application can do that. But i dont know how they do that, what technology they use.

                J Offline
                J Offline
                jan larsen
                wrote on last edited by
                #7

                Really?, on Win32? Got any links or names? It sounds interesting, allthough the use of it goes beyond my imagination. "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

                1 Reply Last reply
                0
                • J john_tran

                  Oh, i see some application can do that. But i dont know how they do that, what technology they use.

                  J Offline
                  J Offline
                  jan larsen
                  wrote on last edited by
                  #8

                  By the way, how did you notice that the files were hidden :-) "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

                  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