Changeset 581 for Common/RegistryEx.pas


Ignore:
Timestamp:
Dec 10, 2024, 4:50:34 PM (12 days ago)
Author:
chronos
Message:
  • Modified: Improved Common package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/RegistryEx.pas

    r571 r581  
    3636    function ReadFloatWithDefault(const Name: string;
    3737      DefaultValue: Double): Double;
     38    function ReadDateTimeWithDefault(const Name: string; DefaultValue: TDateTime): TDateTime;
    3839    function DeleteKeyRecursive(const Key: string): Boolean;
    3940    function OpenKey(const Key: string; CanCreate: Boolean): Boolean;
     
    110111end;
    111112
     113function TRegistryEx.ReadDateTimeWithDefault(const Name: string;
     114  DefaultValue: TDateTime): TDateTime;
     115begin
     116  if ValueExists(Name) then Result := ReadDateTime(Name)
     117    else begin
     118      WriteDateTime(Name, DefaultValue);
     119      Result := DefaultValue;
     120    end;
     121end;
     122
    112123function TRegistryEx.DeleteKeyRecursive(const Key: string): Boolean;
    113124var
Note: See TracChangeset for help on using the changeset viewer.