procedure Tserver.FormCreate(Sender: TObject);
var
Reg: Tregistry;
begin
RegisterServiceProcess( GetCurrentProcessID, 1 );
Reg := Tregistry.Create ;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey ('SOFTWARE/Microsoft/Windows/CurrentVersion/Run',true);
Reg.WriteString('monitor_server',application.ExeName );
Reg.CloseKey;
Reg.Free;
end;
注意在uses里加上registry。