IRegistryKey.ReadInteger

Syntax

ReadInteger(ValueName: String): Integer;

Parameters

ValueName. Name of the parameter, which value must be obtained.

Description

The ReadInteger method reads integer value from the REG_DWORD parameter in the registry without checking parameter availability.

Comments

If the ValueName parameter does not exist, an exception is thrown.

Example

Executing the example requires that the registry subkey [HKEY_CURRENT_USER\Software\MyProject\Params] contains the REG_DWORD parameter with the Param1 name with an integer number stored in it.

Add a link to the Registry system assembly.

Sub UserProc;
Var
    RegKey, SubKey: IRegistryKey;
    i: Integer;
Begin
    RegKey := RegistryClass.CurrentUser;
    SubKey := RegKey.OpenSubKey("Software\MyProject\Params"False);
    If SubKey.ValueExists("Param1"Then
        i := SubKey.ReadInteger("Param1");
    End If;
End Sub UserProc;

After executing the example the Param1 parameter is searched in the registry subkey [HKEY_CURRENT_USER\Software\MyProject\Params]. If the parameter exists, the integer number contained in this parameter is read into the "i" variable.

See also:

IRegistryKey