IRegistryKey.ReadIntegerDef

Syntax

ReadIntegerDef(ValueName: String; DefaultValue: Integer): Integer;

Parameters

ValueName - name of the parameter, which value must be obtained.

DefaultValue - value that is used if parameter does not exist.

Description

The ReadIntegerDef method reads integer value from the REG_DWORD parameter in the registry. If the ValueName parameter does not exist, the method returns DefaultValue.

Example

Sub Main;

Var

RegKey, SubKey: IRegistryKey;

i: Integer;

Begin

RegKey := RegistryClass.CurrentUser;

SubKey := RegKey.OpenSubKey("Software\MyProject\Params", False);

i := SubKey.ReadIntegerDef("Param1", 13);

End Sub Main;

After executing the example integer value is read from the parameter with the Param1 name located in the registry subkey HKEY_CURRENT_USER\Software\MyProject\Params into the "i" variable. If the parameter does not exist, the "i" variable contains the 13 value.

See also:

IRegistryKey