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. Where do I write user data in Win7?

Where do I write user data in Win7?

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
8 Posts 5 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.
  • K Offline
    K Offline
    Koolski
    wrote on last edited by
    #1

    Where do I update my program to create user data? The program data needs to be global to all users on the machine and must not be in a hidden or protected folder because occasionally users do have to access the data to get a file or place a file. Currently it's written to sub-directories off of "c:\Program Files\ProgramNameAndVersionHere" Do I need to just do this the Win 3.1 way and write to "c:\ProgramNameHere"?:confused: Thanks in advance.

    C M R 3 Replies Last reply
    0
    • K Koolski

      Where do I update my program to create user data? The program data needs to be global to all users on the machine and must not be in a hidden or protected folder because occasionally users do have to access the data to get a file or place a file. Currently it's written to sub-directories off of "c:\Program Files\ProgramNameAndVersionHere" Do I need to just do this the Win 3.1 way and write to "c:\ProgramNameHere"?:confused: Thanks in advance.

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Check out this[^] method, i hope it can help you.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers don't kill programs, users kill programs < > "It doesn't work, fix it" does not qualify as a bug report. <

      K 1 Reply Last reply
      0
      • K Koolski

        Where do I update my program to create user data? The program data needs to be global to all users on the machine and must not be in a hidden or protected folder because occasionally users do have to access the data to get a file or place a file. Currently it's written to sub-directories off of "c:\Program Files\ProgramNameAndVersionHere" Do I need to just do this the Win 3.1 way and write to "c:\ProgramNameHere"?:confused: Thanks in advance.

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

        In general, it's a bad idea to let ordinary users modify something in the installation path ("c:\program files", ...) What about using the path "CSIDL_COMMON_APPDATA" or "CSIDL_COMMON_DOCUMENTS" both can be fetch with the SHGetFolderPath API. There's also the "C:\Users\Public" folder, but I'm not certain about that one.

        Watched code never compiles.

        K 1 Reply Last reply
        0
        • M Maximilien

          In general, it's a bad idea to let ordinary users modify something in the installation path ("c:\program files", ...) What about using the path "CSIDL_COMMON_APPDATA" or "CSIDL_COMMON_DOCUMENTS" both can be fetch with the SHGetFolderPath API. There's also the "C:\Users\Public" folder, but I'm not certain about that one.

          Watched code never compiles.

          K Offline
          K Offline
          Koolski
          wrote on last edited by
          #4

          Thanks for both responses. "CSIDL_COMMON_APPDATA" corresponds to "c:\ProgramData" which is a hidden folder in Win7. The documentation says "CSIDL_COMMON_DOCUMENTS" corresponds to "... A typical path is 'C:\Documents and Settings\All Users\Documents' ...". What does that mean in Win7? There is no "c:\Documents and Settings" folder. The "C:\Users\Public" seems the most promising, but how do I get the folder from code since I didn't see any CSIDL or FOLDERID that seemed to correspond?

          C K 2 Replies Last reply
          0
          • C Code o mat

            Check out this[^] method, i hope it can help you.

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers don't kill programs, users kill programs < > "It doesn't work, fix it" does not qualify as a bug report. <

            K Offline
            K Offline
            Koolski
            wrote on last edited by
            #5

            Thanks for responding. Please see my response to Maximilien.

            1 Reply Last reply
            0
            • K Koolski

              Thanks for both responses. "CSIDL_COMMON_APPDATA" corresponds to "c:\ProgramData" which is a hidden folder in Win7. The documentation says "CSIDL_COMMON_DOCUMENTS" corresponds to "... A typical path is 'C:\Documents and Settings\All Users\Documents' ...". What does that mean in Win7? There is no "c:\Documents and Settings" folder. The "C:\Users\Public" seems the most promising, but how do I get the folder from code since I didn't see any CSIDL or FOLDERID that seemed to correspond?

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #6

              I really have not much win7 experience yet (still running XP here), but isn't there also an "All Users" inside c:\users, althorough that might be also hidden. You could try "trial and error" (if google doesn't help), just query for the special folder locations one by one, maybe c:\users\public turns up for one of those CSIDs...

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers don't kill programs, users kill programs < > "It doesn't work, fix it" does not qualify as a bug report. <

              1 Reply Last reply
              0
              • K Koolski

                Thanks for both responses. "CSIDL_COMMON_APPDATA" corresponds to "c:\ProgramData" which is a hidden folder in Win7. The documentation says "CSIDL_COMMON_DOCUMENTS" corresponds to "... A typical path is 'C:\Documents and Settings\All Users\Documents' ...". What does that mean in Win7? There is no "c:\Documents and Settings" folder. The "C:\Users\Public" seems the most promising, but how do I get the folder from code since I didn't see any CSIDL or FOLDERID that seemed to correspond?

                K Offline
                K Offline
                krmed
                wrote on last edited by
                #7

                In Windows 7, Documents and Settings no longer exists...instead there is a folder named Users that has the indivudal user info. Either way, using the GetFolderPath method will return the proper name - Vista or Windows 7. Hope that helps.

                Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

                1 Reply Last reply
                0
                • K Koolski

                  Where do I update my program to create user data? The program data needs to be global to all users on the machine and must not be in a hidden or protected folder because occasionally users do have to access the data to get a file or place a file. Currently it's written to sub-directories off of "c:\Program Files\ProgramNameAndVersionHere" Do I need to just do this the Win 3.1 way and write to "c:\ProgramNameHere"?:confused: Thanks in advance.

                  R Offline
                  R Offline
                  Ravi Bhavnani
                  wrote on last edited by
                  #8

                  Application.CommonAppDataPath[^] will work regardless of the OS on which your app is running. (Sorry, wrong forum.) :-O /ravi

                  My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                  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