• Breaking News

    Panduan dan Tutorial Lengkap serta Materi Pelajaran di Mulyono Blog. Konten Terlengkap dan Terpercaya

    Selasa, 20 September 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.