Андрей021
14.01.2010, 03:06
Как сделать, что бы этот код выполнился при запуске программы, без нажатия на Button, и убрать интерфейс :confused:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Registry, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
reg: TRegistry;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
reg:=tregistry.create;
reg.rootkey:=hkey_current_user;
if reg.openkey('software\My Project', true) then
begin
reg.WriteString('parameter', 'value');
reg.closekey;
end;
reg.free;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Registry, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
reg: TRegistry;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
reg:=tregistry.create;
reg.rootkey:=hkey_current_user;
if reg.openkey('software\My Project', true) then
begin
reg.WriteString('parameter', 'value');
reg.closekey;
end;
reg.free;
end;
end.