procedure ChangeDir(dir: string; SL: TStringList);
var
  SearchRec : TSearchRec;
  Attr : integer;
  Found : integer;
  ExtFileName:string;
  temstr:string;
begin
    SL.Clear;
    //查找该目录下所有*.jpg的文件,并将文件路径及文件名添加到SL
    temstr:=dir+'\*.jpg';
    Attr := faAnyFile;
    Found := FindFirst(temstr, Attr, SearchRec);
    while Found = 0 do
    begin
      //获取扩展名
      //ExtFileName:=LowerCase(ExtractFileExt(SearchRec.Name));
      try
        SL.Add(dir+'\'+SearchRec.Name);
      except
      end;
      Found := FindNext(SearchRec);
    end;
    FindClose(SearchRec);
end;

Last modification:August 16th, 2009 at 12:30 pm
如果觉得我的文章对你有用,请随意赞赏