各位大侠,帮我看看代码有什么问题吗?为什么这样不能搜索目录下的TXT文件?
procedure FindFile(Dir: String);
var
  sr: TSearchRec;
  FileAttrs: Integer;
begin
  FileAttrs := faAnyFile;
  if FindFirst(Dir + '*.mp3', FileAttrs, sr) = 0 then
  begin
    if (sr.Attr and FileAttrs) = sr.Attr then
      ListBox1.Items.Add(Dir + sr.Name);
    while FindNext(sr) = 0 do
      if (sr.Attr and FileAttrs) = sr.Attr then
        ListBox1.Items.Add(Dir + sr.Name);
    FindClose(sr);
  end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
  FindFile('E:\');
end;