Ignore:
Timestamp:
Jan 17, 2025, 9:05:54 PM (4 days ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Modified: Remove U prefix from unit names.
  • Modified: Use Gneeric.Collections instead of fgl.
  • Modified: Do not use global form variables.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/RegistryEx.pas

    r218 r219  
    1 unit URegistry;
    2 
    3 {$MODE delphi}
     1unit RegistryEx;
    42
    53interface
     
    3836    function ReadFloatWithDefault(const Name: string;
    3937      DefaultValue: Double): Double;
     38    function ReadDateTimeWithDefault(const Name: string; DefaultValue: TDateTime): TDateTime;
    4039    function DeleteKeyRecursive(const Key: string): Boolean;
    4140    function OpenKey(const Key: string; CanCreate: Boolean): Boolean;
     
    4847    HKEY_CURRENT_CONFIG, HKEY_DYN_DATA);
    4948
     49
    5050implementation
    51 
    5251
    5352{ TRegistryContext }
     
    112111end;
    113112
     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
    114123function TRegistryEx.DeleteKeyRecursive(const Key: string): Boolean;
    115124var
     
    135144  //CloseKey;
    136145  {$ENDIF}
    137   Result := inherited OpenKey(Key, CanCreate);
     146  Result := inherited;
    138147end;
    139148
Note: See TracChangeset for help on using the changeset viewer.