From RAD Studio API Documentation
Jump to: navigation, search


procedure CreateRegKey(const Key, ValueName, Value: string; RootKey: HKEY);


extern DELPHI_PACKAGE void __fastcall CreateRegKey(const System::UnicodeString Key, const System::UnicodeString ValueName, const System::UnicodeString Value, HKEY RootKey = (HKEY)(0x80000000));


Type Visibility Source Unit Parent
System.Win.ComObj System.Win.ComObj


Creates or opens a registry key that is a subkey of HKEY_CLASSES_ROOT.

CreateRegKey creates or opens the key specified by the Key parameter. If the key does not already exist in the registry, CreateRegKey creates it, otherwise CreateRegKey opens it.

Note: CreateRegKey is useful for implementing the UpdateRegistry method of a class factory.

Key specifies a string that cannot begin with the backslash character ('\'). It must be a subkey of RootKey.

When the key is created, additional value and type information for the specified key can be set from the parameters passed to CreateRegKey.

ValueName points to a string that specifies the name of the subkey associated with value.

Value specifies the data to be stored with the specified value name.

RootKey is the top-level registry key under which the new key is created or opened. If omitted, it is HKEY_CLASSES_ROOT.

If CreateRegKey is not successful, an EOleRegistrationError exception is raised.

See Also