//我做了个例子,你看一下:
procedure TForm1.Button1Click(Sender: TObject);
var
SR : TSearchRec;
lst_Str : TStringList;
begin
lst_Str := TStringList.Create;
try
if FindFirst('c:/temp/*.bmp', faAnyFile, SR) = 0 then
begin
if (sr.Name <> '.') and (sr.Name <> '..') and (sr.Attr <> faDirectory) then
lst_Str.Add(SR.Name);
while FindNext(sr) = 0 do
if (sr.Name <> '.') and (sr.Name <> '..') and (sr.Attr <> faDirectory) then
lst_Str.Add(SR.Name);
FindClose(sr);
end;
ListBox1.Items.Text := lst_Str.Text;
finally
lst_Str.Free;
end;
end;