Re: .ini .dat or registry question
- From: "Mike D Sutton" <EDais@xxxxxxxx>
- Date: Fri, 8 Jul 2005 20:47:47 +0100
> 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/
.
- Follow-Ups:
- Re: .ini .dat or registry question
- From: Karl E. Peterson
- Re: .ini .dat or registry question
- From: Steve Easton
- Re: .ini .dat or registry question
- From: Bob Butler
- Re: .ini .dat or registry question
- References:
- .ini .dat or registry question
- From: Steve Easton
- .ini .dat or registry question
- Prev by Date: Re: "Album art" tag on the mp3s *repost
- Next by Date: Re: .ini .dat or registry question
- Previous by thread: Re: .ini .dat or registry question
- Next by thread: Re: .ini .dat or registry question
- Index(es):
Relevant Pages
|