본문 바로가기
Application/Delphi Lecture

레지스트리 쓰고 읽기

by 현이빈이 2008. 8. 13.
반응형

uses Registry 추가




procedure TForm1.Button3Click(Sender: TObject);
Var
  Reg : TRegistry;
  strRegData : string;
begin
  Reg := TRegistry.Create;
  try
    reg.Rootkey := HKEY_CURRENT_USER;
    //reg.OpenKey('\SOFTWARE\',TRUE)
    //Reg.KeyExists('GrsSystem')
    Reg.OpenKey('\SOFTWARE\GRSSYSTEM\',TRUE);
    Reg.WriteString('GrsDBConnectString',edit3.Text);
  finally
    reg.Free;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
Var
  Reg : TRegistry;
  strRegData : string;
begin
  Reg := TRegistry.Create;
  try
    reg.Rootkey := HKEY_CURRENT_USER;
    //reg.OpenKey('\SOFTWARE\',TRUE)
    //Reg.KeyExists('GrsSystem')
    Reg.OpenKey('\SOFTWARE\GRSSYSTEM\',TRUE);
    strRegData := Reg.ReadString('GrsDBConnectString');
    edit2.text := strRegData;
  finally
    reg.Free;
  end;
end;

반응형