开机启动函数

//开机启动函数
function  FirstRunSystem(bool: Boolean):Boolean;
var
      Reg   :   TRegistry;
  begin
      Reg   :=   TRegistry.Create;
      Reg.RootKey   :=   HKEY_LOCAL_MACHINE;
      try
          Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False);
          if   bool   then  
               Reg.WriteString(Application.Title,Application.ExeName)
          else    
               Reg.DeleteValue(Application.Title);
      finally
          Reg.CloseKey;
          Reg.Free;
      end;
  end;

posted @ 2013-04-17 17:27  狐狸乌鸦  阅读(195)  评论(0编辑  收藏  举报