Click here to Skip to main content
15,920,632 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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. Do I need to just do this the Win 3.1 way and write to "c:\ProgramNameHere"?
Posted

"C:\ProgramData\" is the root folder. MS recommends using
"C:\ProgramData\Company\Application\"

To get the root folder, you can use this API:
SHGetSpecialFolderPath(0, szPath, CSIDL_COMMON_APPDATA, TRUE)

Look on MSDN for CSIDL_COMMON_APPDATA. This is for all users. You can also use CSIDL_APPDATA for the current user.

Don't forget you may have to create the folder hierarchy.
 
Share this answer
 
v2
I always thought that the Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) was the place for this sort of data. Although I do not know if it meets your criteria regarding "The program data needs to be global to all users on the machine and must not be in a hidden or protected folder"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900