Working with ini Files and the System Registry
Go Up to Working with Files
Many applications use ini files to store configuration information. The VCL/RTL includes two classes for working with ini files:
Using ini files has the advantage that they can be used in cross-platform applications and they are easy to read and edit. For information on these classes, see Using TIniFile and TMemIniFile for more information.
Many Windows applications replace the use of ini files with the system Registry. The Windows system Registry is a hierarchical database that acts as a centralized storage space for configuration information. The VCL includes classes for working with the system Registry. Two of these classes, TRegistryIniFile and TRegistry, are discussed here because of their similarity to the classes for working with ini files:
- System.Win.TRegistryIniFile is useful for cross-platform applications, because it shares a common ancestor (System.IniFiles.TCustomIniFile) with the classes that work with ini files. If you confine yourself to the methods of the common ancestor (TCustomIniFile), your application can work on both applications with a minimum of conditional code. TRegistryIniFile is discussed in Using TRegistryIniFile.
- System.Win.Registry.TRegistry is useful for applications that are not cross-platform. The properties and methods of TRegistry have names that correspond more directly to the way the system Registry is organized, because it does not need to be compatible with the classes for ini files. TRegistry is discussed in Using TRegistry.