From RAD Studio API Documentation
Jump to: navigation, search


function LoadKey(const Key, FileName: string): Boolean;


bool __fastcall LoadKey(const System::UnicodeString Key, const System::UnicodeString FileName);


Type Visibility Source Unit Parent
function public
System.Win.Registry TRegistry


Creates a subkey under the root key and loads registry information from a file into the newly created subkey.

Call LoadKey to:

1Create a new subkey under the root key, and

2Load registry information from a file into the subkey. Registry information can include data values, subkeys, and data values for those subkeys.

LoadKey is intended to simplify creation of a key, its values and subkeys, and the values for those subkeys in a single operation. A key, its subkeys, and all data values of the key and its subkeys is called a hive. Rather than creating each key and value separately, an application can read a hive from a file. This is especially useful for applications that users can reconfigure at run time.

Note: Before an application calls LoadKey, the RootKey property must be set to HKEY_USERS, HKEY_LOCAL_MACHINE, or to a key returned by a previous call to RegistryConnect.

The Key parameter is the name of the subkey to create. The FileName parameter is the location of the file containing registry information to store in the subkey. The file specified by FileName must be one previously created using the SaveKey function or the RegSaveKey Windows API function. On systems that use a file allocation table (FAT), FileName cannot include an extension.

See Also