Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32 Application Settings

How can I store settings that can later be loaded into my application?

For instance, I have an edit control that the user can change the font, font color, and background color of. When the user changes these, I would like to save them so that when the user opens the application again the fonts and colors will be the same as they left them.

I had thought about writing to the windows registry, but not only am I confused as to how to save fonts there, (or even if you could do such a thing), but I also have a portable version that can be run off of a flash-drive. Is there any way to save these settings to a file that is in the same directory as the executable? If so, how would I go about saving and loading these?

If there isn't a way to accomplish this using a settings file, how could I use the windows registry to do it?

like image 245
Brandon Miller Avatar asked Dec 08 '25 14:12

Brandon Miller


1 Answers

Best way IMO is to store it in ini files, for example, one file : app.ini

[AppSettings]
fntBackground=255 255 0
fntFace=Tahome

[LoadDialog]
...

it is quite easy to write it yourself, you can also find ready classes on codeproject, I took a fast search and found this:

http://www.codeproject.com/Articles/5401/CIni

looks promising

like image 96
marcinj Avatar answered Dec 10 '25 03:12

marcinj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!