送给你一个函数
function setAutoStart(flag: integer): boolean;
var reg:TRegistry;
begin
result:=true;
reg:=TRegistry.Create;
reg.RootKey:=HKEY_LOCAL_MACHINE;
TRY
reg.OpenKey('SOFTWARE/Microsoft/Windows/CurrentVersion/Run',true);
if flag=0 then//flag为0时取消自动启动
Reg.DeleteValue('软件标识');
else//flag为非0时设置自动启动
reg.WriteString('软件标识','"'+application.ExeName+'"')
except
result:=false;
end;
reg.CloseKey;
reg.Free;
end;