例如:
procedure Dir(Mask: String; ss: TStrings);
var
FileInfo: TSearchRec;
begin
ss.Clear;
if FindFirst(Mask, faAnyFile, FileInfo) = 0 then
begin
repeat
if FileInfo.Attr and faDirectory = 0 then
begin
ss.Add(FileInfo.Name);
end;
until FindNext(FileInfo) <> 0;
end;
FindClose(FileInfo);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Dir('d:/*.*', ListBox1.Items);
end;