Is there any standard way to work with application settings in WinAPI? What I'm doing currently is this:
if(!ReadKey(some_setting))
WriteKey(some_setting, some_setting_setting_default_value)
when the settings dialog is initialized. Then I set the widget states to the corresponding values read from the registry. The problem is that if the application is run for the first time, the default settings can't be read following the above code pattern. One more ReadKey()
is necessary to read the just written default settings into the settings variable in my program. This looks a bit clumsy to me. So the question basically is:
- is there any standard way to work with settings in Win32?
- and, most importantly, is there any way to set up default application settings during installation, so that there would be code to set the default settings at all? (which I guess is the preferred method, as then you could modify the default application settings without rebuilding it)
Again, this should be pure Win32, no MFC allowed.
Why is this homework? This is question about whether there is an established practice of doing things, not a request to do my job for me. Now I better remove the "university project" phrase from there.