I want to save my programs options in an ini file. I know how to do that, but i want to save them for every user. How do i do this? Currently im using
invoke WritePrivateProfileString, addr section, addr key, addr buffer, addr inifile


And inifile is "appname.ini". But that just saves it to an ini file in the windows directory. I thought somehow i could save them in an ini file in the users home directory or something.
Posted on 2002-03-16 23:24:06 by ChimpFace9000
You can supply a full path for the ini file, then you just need to figure out the current user's path.
But wouldn't it be easier to use the registry? As it has a HKEY_CURRENT_USER...

Thomas
Posted on 2002-03-17 03:20:50 by Thomas
No, i cant stand the registry. And im also making the program so that the user has to go in and change options in the ini file.
Posted on 2002-03-17 03:34:51 by ChimpFace9000
Well, you could make an ini file for each user.
Or if you want only one ini file, you could just make a section for each user.
Posted on 2002-03-17 06:44:53 by Vom-bonjour:-()
I don't really like the registry either, but it's the way to go if you
want to support multiuser stuff, and especially if you plan to support
NT... on a lot of (office/school) setups, you don't have the necessary
permissions to write to, for instance, the "program files" folder.
Of course storing the ini file in the user "home directory" (my documents)
would solve that, but then you need registry access anyway...
Posted on 2002-03-17 07:41:56 by f0dder
You can use GetUserName and use that as a ini filename, or use SHGetSpecialFolderPath to get a path that's different for every use, but some constants for this function are OS & version specific.

If you write some wrappers around the registry functions to cover all the user details, using the registry shouldn't be too hard.

Thomas
Posted on 2002-03-17 08:01:41 by Thomas