// 设置开机自动运行注册表项 / 删除注册表项
procedure TForm1.SetAutoRun(ok : boolean );
var
reg:TRegistry;
begin
reg := getRegistry;
try
reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',false);
if ok then
reg.WriteString('trayicon',application.ExeName)
else
reg.DeleteValue('trayicon');
except
on e:Exception do
begin
showmessage('设置失败!');
end;
end;
reg.Free;
end;