var
i: Integer;
SearchRec: TSearchRec;
strlst:TStringlist;
begin
     strlst:TStringlist.create;
i:=FindFirst('*.*',faAnyFile,SearchRec);
while i=0 do
begin
strlst.Add(SearchRec.Name);
i := FindNext(SearchRec);
end;
end;
  

解决方案 »

  1.   

    with StringGrid1 do
      begin
        RowCount := 0;    if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then    begin
          repeat
            if (sr.Attr and FileAttrs) = sr.Attr then
            begin
            RowCount := RowCount + 1;
            Cells[1,RowCount-1] := sr.Name;
            Cells[2,RowCount-1] := IntToStr(sr.Size);
            end;
          until FindNext(sr) <> 0;
          FindClose(sr);
        end;
      end;