WriteDateTime(ValueName: String; Value: DateTime);
ValueName. Name of the parameter, which value should be changed.
Value. Value that should be set for parameter in the registry.
The WriteDateTime method changes value of the parameter containing date and time.
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.
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 date and time value
SubKey.WriteDateTime("Param1", DateTime.Now);
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 current date and time value.
See also: