Re: .ini .dat or registry question



> Which is better used to store 2 or 3 simple program settings, an ini file, dat file or the registry.
>
> From reading posts here, it seems using the registry is frowned upon, but everything I read
> recommends "against" using a file of any sort.

Depending on what these settings are then registry would probably be my choice, this assumes that your settings are short strings or
numeric values though, not entire data files or data which would be more appropriate elsewhere.
There are a number of benefits to using the registry such as allowing settings to be stored far easier on a per-user basis (using
HKEY_CURRENT_USER), implementing this with INI files is possible but not as clean.
Another is that INI files are 'flat' where was registry settings can be stored with more structure, which lends itself well to a
well object-oriented model.
Having INI files sitting in the application directory, especially as a plain-text format, also leads to inquisitive users poking
around and changing things they really shouldn't. While the registry is also just as vulnerable to this kind of tampering, most
users who have a good enough knowledge of the registry to dig that deep will generally also be able to restore settings should
everything blow up, saving you support time (and those kinds of problems are real tricky to track down!)
Finally the different value types that the registry offers mean that 'hard-typed' settings are possible - I cringe every time I have
to save numeric data to an INI file as strings - bleugh!
At the end of the day though it's largely personal preference, despite what some old timers (mentioning no names.. ;) will tell you.
Having said that though, you should be fairly restrained about what and how much information you do store in the registry - there
are many cases where a simple binary data file will work far better for some application data.
Oh by registry in the above I mean proper API driven registry access, VB's registry 'functionality' simply doesn't cut it..
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/


.



Relevant Pages

  • Re: Last details before the first release
    ... I used to store everything to the registry but now have moved to the ... Settings to load the icon. ... Software Protection and Trial period would definitely be useful. ...
    (borland.public.delphi.non-technical)
  • Re: Does Sonia Colemans MPP/Multimedia download apply to Windows XP?
    ... The first one is labeled Registry Editor, ... MCI settings are in the system Registry. ... Echo ... > Look at the screen shots for the registry settings for WinXP as opposed to> the INI files. ...
    (microsoft.public.powerpoint)
  • Re: square bullets
    ... that it makes backing up programs' settings somewhat easier, ... INI files don't allow multiple levels of hierarchy, ... drop" design, and if each control needs to store its own settings somewhere, ... registry again of course) rather than somehow having to interact with the ...
    (sci.electronics.design)
  • Re: Using INI files
    ... You can use INI files or the system registry to save settings ...
    (microsoft.public.excel.programming)
  • Re: Registry verses INI
    ... With the registry, I can tell the app to write to the HKEY_CURRENT_USERS ... So wouldn't this be a better place to store configuration data ... Blame Microsoft for changing ... MS said "Don't use INI files anymore. ...
    (microsoft.public.vb.general.discussion)