如何在启动系统(win98/2000)时启动我的*.exe程序

解决方案 »

  1.   

    最简单的办法把你的exe文件添加到开始菜单的启动子菜单中
      

  2.   

    写入注册表的
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
      

  3.   

    开机自动运行
    procedure TMainFrm.N5Click(Sender: TObject);
    var
       FilePath:string;
      Reg:Tregistry;
      SubKey:string;
    begin
        N5.Checked:=not N5.Checked;
        Reg:=Tregistry.Create;
        Reg.RootKey:=hkey_local_machine;
        FilePath:=Application.ExeName;
        SubKey:='\Software\Microsoft\Windows\CurrentVersion\run';// ????????
        if N5.Checked=true then      try
            if reg.OpenKey(SubKey,true) then
            if not reg.ValueExists(ExtractFileName(Application.ExeName)) then
              reg.WriteString(ExtractFileName(Application.ExeName),FilePath);
          finally
              reg.CloseKey;
              reg.Free;      end
        else
           try
            if reg.OpenKey(SubKey,false) then
            if reg.ValueExists(ExtractFileName(Application.ExeName)) then
                reg.DeleteValue(ExtractFileName(Application.ExeName));
          finally
            reg.CloseKey;
            reg.Free;
          end;end;
      

  4.   

    把你的程序写成一个SERVICE;不用登陆就可运行
      

  5.   

    procedure TMainFrm.FormCreate(Sender: TObject);
    var
      registerTemp : TRegistry;
      tmpStr : string;
    begin
      registerTemp := TRegistry.Create;
      with registerTemp do
         begin
            RootKey := HKEY_LOCAL_MACHINE;
            if OpenKey('Software\Microsoft\Windows\CurrentVersion\run',True) then
              begin
                readkey(HKEY_LOCAL_MACHINE,
                  'Software\Microsoft\Windows\CurrentVersion\run',
                    extractfilename(Application.ExeName),tmpStr);
                if tmpStr<>'' then
                   //DeleteRegistry(extractfilename(Application.ExeName));               DeleteValue(extractfilename(Application.ExeName));            WriteString(extractfilename(Application.ExeName),Application.ExeName);
              end;
            CloseKey;
         end;
    end;
      

  6.   

    //寫注冊表
    procedure TForm1.FormShow(Sender: TObject);
    var 
        tempreg:TRegistry;
    begin    tempreg:=TRegistry.Create;
        tempreg.RootKey:=HKEY_LOCAL_MACHINE;
        tempreg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);  
        tempreg.WriteString('test',Application.Exename);
        tempreg.Closekey;
        tempreg.Free;
    end; 
      

  7.   

    写入注册表的
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
      

  8.   

    写注册表
    如果找简单的就直接放到开始启动菜单里
    如果没有界面做成Service也是一种不错的选择