在注册表中,加入:
  sName1:='ABC';     // 程序名称 
  sValue1:= ExtractFilePath(application.ExeName) + 'ABC.exe';  // 绝对路径
  Reg:=TRegistry.Create;
  Reg.RootKey:=HKEY_LOCAL_MACHINE;
  try
    Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False);
    Reg.WriteString(sName1,sValue1);
  finally
    Reg.CloseKey;
    Reg.Free;
  end;

解决方案 »

  1.   

    这是在程序中,设置加入与自身存放同一目录的,程序ABC.exe,设置成自启动。
      

  2.   

    嘿嘿,你理解错了,我不是说加到自启动里,因为这个在win7下无法自动启动带UAC程序的,我的要求是加入到windows计划任务中,让电脑启动时自动执行一次启动任务
      

  3.   

    XP和Vista,Win7的接口不同.
    启动任务和其他任务一样只是参数不同而已
      

  4.   

    http://msdn.microsoft.com/zh-cn/subscriptions/bb706776.aspxFunction Description
    NetScheduleJobAdd Submits a job to run at a specified future date and time.
    NetScheduleJobDel Cancels a range of jobs queued to run on a computer.
    NetScheduleJobEnum Lists the jobs queued on a specified computer.
    NetScheduleJobGetInfo Returns information about a particular job queued on a computer.
    GetNetScheduleAccountInformation Retrieves the AT Service account name.
    SetNetScheduleAccountInformation Sets the AT Service account name and password.