Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 views
in Technique[技术] by (71.8m points)

When - and why - should you store data in the Windows Registry?

As a developer, tools that store configuration/options in the registry are the bane of my life. I can't easily track changes to those options, can't easily port them from machine to machine, and it all makes me really yearn for the good old days of .INI files...

When writing my own applications, what - if anything - should I choose to put in the registry rather than in old-fashioned configuration files, and why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  • Originally (WIN3) configuration was stored in the WIN.INI file in the windows directory.
  • Problem: WIN.INI grew too big.
  • Solution (Win31): individual INI files in the same directory as the program.
  • Problem: That program may be installed on a network and shared by many people.
  • Solution(Win311): individual INI files in the user's Window directory.
  • Problem: Many people may share a windows folder, and it should be read-only anyway.
  • Solution (Win95): Registry with separate sections for each user.
  • Problem: Registry grew too big.
  • Solution (WinXP): Large blocks of individual data moved to user's own Application Data folder.
  • Problem: Good for large amounts of data, but rather complex for small amounts.
  • Solution (.NET): small amounts of fixed, read-only data stored in .config (Xml) files in same folder as application, with API to read it. (Read/write or user specific data stays in registry)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...