By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,067 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,067 IT Pros & Developers. It's quick & easy.

Registry vs. ini-files

P: n/a
Hello all!

Iīm going to develop a windows smartclient and canīt find the information I
need. Where do I store user-settings like paths, background colour and so
on. Iīve read an article about the ups and downs of registry versus files
but i canīt find it now. Can someone please help me?

Thanks in advance!
/Bobby
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
in my opinion, the registry should only be used when the
nature of the application absolutely requires it.

COM applications are an excellent example of this need. A
COM application allows other applications to use its COM
control through its class ID (clsid). This ID is easily
placed in the registry by the COM server application, and
easily retrieved by a COM client. Without a central data
repository like the registry, writing COM apps would be
that much harder - perhaps even impossible.

more details you can find at
http://www.crtimmonsinc.com/Frontend...DesktopDefault
..aspx?tabid=1015.

But the best way if you are using .NET is config files.
-----Original Message-----
Hello all!

Iīm going to develop a windows smartclient and canīt find the information Ineed. Where do I store user-settings like paths, background colour and soon. Iīve read an article about the ups and downs of registry versus filesbut i canīt find it now. Can someone please help me?

Thanks in advance!
/Bobby
.

Jul 19 '05 #2

P: n/a
Bob Olsson wrote:
Hello all!

Iīm going to develop a windows smartclient and canīt find the
information I need. Where do I store user-settings like paths,
background colour and so on. Iīve read an article about the ups and
downs of registry versus files but i canīt find it now. Can someone
please help me?

Thanks in advance!
/Bobby


Just to supplement the questions you have had so far. Microsoft is
discouraging developers from using the registry or INI files. The problem
with the registry is that it involves a separate 'registration' step (this
may be hidden: occuring when the app first starts), and the data resides in
a location other than the application directory. This means that if you move
the app to another machine the settings don't move with it. If you uninstall
the app, you have to remove the registry settings. INI files can be stored
in the app directory, but they are limited due to their format, XML is far
more flexible.

Config files are XML files in the app directory, so you can copy or delete
them. However, config files are read-only (the current version of the
framework does not have a class specifically to read them, although you can
use the XML classes). They should be treated in the same way as command line
switches, ie, the app does not write to the config file and even if it does,
the settings are not picked up by the app until it is restarted. (Contrast
that to the registry and INI files, where settings can be re-read).

Also, settings in the config file are per-app, they are not per-user as you
are requesting. One solution is to read/write an XML file in Isolated
Storage. On this page:
http://www.c-sharppro.com/features/2...200309rg_f.asp I
explain some code to do this. The downside of using isolated storage is that
the file is not stored in the app folder, so if you move the app or delete
it the isolated storage is not affected. (The location of the files used in
isolated storage is a little cryptic.)

Richard
--
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.