![]() |
![]() ![]() ![]() |
acStringListContainer component.
|
procedure StoreToRegistry(Reg: TRegistry); overload;
|
procedure StoreToRegistry(const KeyName: String; const RootKey: hKey = HKEY_CURRENT_USER); overload;
|
The StoreToRegistry method saves all content of the string list to the registry.
|
|
There is 2 overloaded methods of calling the StoreToRegisty:
|
1. The registry key must be previously opened and handle to TRegistry object must be passed with Reg parameter (see first example below);
|
2. You must pass the KeyName and the RootKey (HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE) as parameters (see second example below).
|
![]() |
uses Registry;
|
|
procedure TForm1.Button1Click(Sender: TObject);
|
var
|
MyKey: String;
|
Reg: TRegistry;
|
begin
|
MyKey := 'SOFTWARE\My Company Name\My Program Name\StringList';
|
|
Reg := TRegistry.Create;
|
with Reg do
|
try
|
RootKey := HKEY_CURRENT_USER;
|
DeleteKey(MyKey); // delete old values from that registry key before store new
|
if OpenKey(MyKey, True) then
|
acStringListContainer1.StoreToRegistry(Reg);
|
finally
|
Free;
|
end;
|
end;
|
procedure TForm1.Button1Click(Sender: TObject);
|
begin
|
acStringListContainer1.StoreToRegistry('SOFTWARE\My Company Name\My Program Name\StringList');
|
end;
|
LoadFromRegistry, SaveToFile and LoadFromFile methods;
|
Strings, Names, Values, MaxSize and Duplicates properties.
|