Where do I write user data in Win7?
-
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.
-
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.
-
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.
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.
-
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.
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?
-
-
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?
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. <
-
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?
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
-
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.
Application.CommonAppDataPath
[^] will work regardless of the OS on which your app is running. (Sorry, wrong forum.) :-O /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com