IRegistryKey.WriteInteger

Syntax

WriteInteger(ValueName: String; Value: Integer);

Parameters

ValueName. Name of the parameter, which value should be changed.

Value. Value that should be set for parameter in the registry.

Description

The WriteInteger method changes value of the parameter containing integer numbers.

Comments

If the parameter or subkey do not exist, it is created automatically. If the parameter exists, the type and value is changed according to the entered data.

If it is required to change value of the default parameter, pass empty string ("") as a name.

Example

Executing the example requires that the registry contains a parameter named Param1 located in the subkey [HKEY_CURRENT_USER\Software\MyProject\Params].

Add a link to the Registry system assembly.

Sub UserProc;
Var
    RegKey, SubKey: IRegistryKey;
Begin
    
// Get subkey with user settings
    RegKey := RegistryClass.CurrentUser;
    SubKey := RegKey.OpenSubKey(
"Software\MyProject\Params"True);
    
// Set integer value for parameter
    SubKey.WriteInteger("Param1"100);
End Sub UserProc;

After executing the example the parameter named Param1 located in the subkey [HKEY_CURRENT_USER\Software\MyProject\Params] is set to the integer value 100.

See also:

IRegistryKey