Monday, September 19, 2011

Aplikasi berjalan secara otomatis

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses registry;

{$R *.DFM}

procedure TForm1.FormDestroy(Sender: TObject);
begin
  with TRegistry.Create do try
    RootKey := HKEY_LOCAL_MACHINE;
    OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', True);
    WriteString('Programku', Application.ExeName);
    CloseKey;
  finally
    Free;
  end;
end;

end.

No comments:

Post a Comment