this slowpoke moves

Type & Read Registry

uses Registry

// Schreiben in die Regitsry
procedure TForm1.Button1Click(Sender: TObject);
var 
  reg: TRegistry;
begin 
  reg := TRegistry.Create; 
  try 
    reg.RootKey := HKEY_LOCAL_MACHINE;
    reg.OpenKey('Software\aa', True);
    reg.WriteString('Test string', 'Test');
    reg.CloseKey; 
  finally 
    reg.Free; 
  end; 
end;

// Lesen von der Registry
procedure TForm1.Button2Click(Sender: TObject);
begin
with TRegistry.Create do
  begin
  try
  	Rootkey:=HKEY_LOCAL_MACHINE;
  		if OpenKey('Software\aa',True)
  		then
  		begin
  		Edit1.Text:=ReadString('Test String');
  		//Edit1.Value:=ReadInteger('TestInteger');
  	end;
  finally
  Free;
  end;
 end;
end;


Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate