谢谢!

解决方案 »

  1.   

    方法1  用api函数
    方法2  另写一个删除程序的批处理,写到注册表中的runonce里,下次起动时,删除!!!!!!!
      

  2.   

    Mark,我也想知道。
    我此前的办法是到时间后程序写一个autoexec.bat下次开机时就删除了,而且,连那个程序一起删除,autoexec.bat也删!
      

  3.   

    NT:MoveFileEx
    或:
    procedure DeleteSelf;
    var
      BatchFile: TextFile;
      BatchFileName: string;
      ProcessInfo: TProcessInformation;
      StartUpInfo: TStartupInfo;
    begin
      BatchFileName := ChangeFileExt(Paramstr(0),'.bat');
      AssignFile(BatchFile, BatchFileName);
      Rewrite(BatchFile);
      // build cmd batch file
      Writeln(BatchFile, ':try');
      Writeln(BatchFile, Format('del "%s"', [ParamStr(0)]));
      Writeln(BatchFile, Format('if exist "%s" goto try', [ParamStr(0)]));
      Writeln(BatchFile, 'del %0');
      CloseFile(BatchFile);
      FillChar(StartUpInfo, SizeOf(StartUpInfo), $00);
      StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
      StartUpInfo.wShowWindow := SW_HIDE;
      // create hidden process
      if CreateProcess(nil, PChar(BatchFileName), nil, nil,False, IDLE_PRIORITY_CLASS,
                       nil, nil, StartUpInfo,ProcessInfo) then
         begin
           CloseHandle(ProcessInfo.hThread);
           CloseHandle(ProcessInfo.hProcess);
         end;
    end;
      

  4.   

    删除自己好说,但要定就要自己写了:http://218.56.11.178:8020/web/lie_fallow.aspx-》下载基地-》例程-经典应用-》自杀程序
      

  5.   

    给分就要结贴吗?那LiuYang老弟,我一定给你20分,但我想再等两天,看还有更直接的没有,我再加分。
      

  6.   

    LIU YANG老弟,还有个问题,程序能在指定日期删除,可如果指定日期的当天没有运行这个程序,你的代码就不再起作用了,怎么办?
      

  7.   

    我试过了,改成:if date>=strTodate('2003-8-12')then
    deleteself;
    end;