unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, registry;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
reg : TRegistry;
implementation
{$R *.DFM}
procedure TForm1.Button2Click(Sender: TObject);
begin
Close; // menutup form
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey ('\Software\Microsoft\Windows\CurrentVersion', false);
Edit1.Text := reg.ReadString ('RegisteredOwner');
Edit2.Text := reg.ReadString ('RegisteredOrganization');
reg.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey ('\Software\Microsoft\Windows\CurrentVersion', false);
reg.WriteString ('RegisteredOwner', Edit1.Text);
reg.WriteString ('RegisteredOrganization', Edit2.Text);
reg.Free;
end;
end.
Download contohnya
sebelumnya..... back to tutorial delphi home....
Tidak ada komentar:
Posting Komentar