System.Win.Registry.TRegistryIniFile

From RAD Studio API Documentation
Jump to: navigation, search

System.IniFiles.TCustomIniFileSystem.TObjectTRegistryIniFile

Delphi

TRegistryIniFile = class(TCustomIniFile)

C++

class PASCALIMPLEMENTATION TRegistryIniFile : public System::Inifiles::TCustomIniFile

Properties

Type Visibility Source Unit Parent
class public
System.Win.Registry.pas
System.Win.Registry.hpp
System.Win.Registry System.Win.Registry

Description

TRegistryIniFile is a wrapper for the Windows system registry.

TRegistryIniFile presents a simple interface to the system registry and hides the need to know about the underlying structure of the registry. TRegistryIniFile enables handling the Windows system registry as if it were a Windows 3.x INI file. Instead of processing an INI file, however, TRegistryIniFile reads from and writes to the system registry. Because TRegistryIniFile, like TIniFile, descends from TCustomIniFile, you can use it in common code that writes to both INI files and the registry.

In addition, application developers that are switching from the use of INI files to the system registry can use this object to migrate their application with a minimum of coding changes. By finding all references to TIniFile in an application, replacing them with TRegistryIniFile, and recompiling the application, a developer can update an application to use the system registry instead of INI files without having to code any new logic into the application.

Note: Information contained in existing users' INI files is not migrated into the system registry using the method described above. A one-time operation to explicitly copy the INI file data, through TRegistryIniFile, must be used to do this.

TRegistryIniFile adapts the methods inherited from TCustomIniFile to operate on Registry entries rather than INI file keys. It reinterprets the FileName property as a subkey under the system registry's root key (HKEY_CURRENT_USER by default). What corresponds to a section in an INI file is treated as a key in the system registry, and what corresponds to data entries under a section in an INI file are treated as data values under a key in the system registry.

See Also

Code Examples