急~~~如题~

解决方案 »

  1.   

    用FindFirst、FindNext遍历目录下所有文件,比较创建日期,最晚创建的那个就是你要的文件了
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var ss:Tsearchrec;
        filepath:string;
        fileTime:integer;
        fileName:string;
    begin
       filepath:='c:\';
       if findfirst(filepath+'*.*',faAnyFile,ss)=0 then
       begin
          if not ((ss.Attr and fadirectory)=fadirectory) then
          begin
              fileTime:=ss.Time;
              fileName:=ss.Name;
          end;
          while findnext(ss)=0 do
          begin
              if not ((ss.attr and fadirectory)=fadirectory) then
              begin
                  if ss.Time<fileTime then
                  begin
                      fileTime:=ss.Time;
                      fileName:=ss.Name;
                  end;
              end;
          end;
          findclose(ss);
          showmessage(filename);
       end;
    end;
      

  3.   

    有点小毛病,没有初始化fileTimer的值
    把这句家在开头就可以了
    fileTime:=2147483647;