参考:http://www.delphibbs.com/delphibbs/dispq.asp?lid=1313570<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br> SR:TSearchRec;<br> filter:TStrings;<br> s:string;<br>begin<br> filter:=TStringList.create;<br> filter.add('BMP');<br> filter.add('SCR');<br> filter.add('EXE');<br> if FindFirst('c:/windows/system/*.*', $3f, sr)=0 then<br> begin<br> while FindNext(sr)=0 do<br> begin<br> s:=trim(UpperCase(extractFileExt(sr.Name)));<br> if length(s)=0 then continue;<br> if s[1]='.' then s:=copy(s,2,length(s)-1);<br> if filter.IndexOf(s)>=0 then showmessage(sr.Name);<br> end;<br> FindClose(sr);<br> end;<br> filter.free;<br>end;<br>