IRegistryKey.ReadDateTimeDef

Syntax

ReadDateTimeDef(ValueName: String; DefaultValue: DateTime): DateTime;

Parameters

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

DefaultValue. Value that is used if parameter does not exist.

Description

The ReadDateTimeDef method reads date and time from binary parameter in the registry.

Comments

If the parameter with the ValueName name does not exist, the method returns value from the DefaultValue parameter.

Example

Add a link to the Registry system assembly.

Sub UserProc;
Var
    RegKey, SubKey: IRegistryKey;
    d: DateTime;
Begin
    RegKey := RegistryClass.CurrentUser;
    SubKey := RegKey.OpenSubKey("Software\MyProject\Params"False);
    d := SubKey.ReadDateTimeDef("Param1", DateTime.Now);
End Sub UserProc;

After executing the example, value of date and time is read from the parameter with the Param1 name located in the registry subkey [HKEY_CURRENT_USER\Software\MyProject\Params] into the "d" variable. If the parameter does not exist, the "d" variable contains the value of the current date and time.

See also:

IRegistryKey