procedure TMainForm.addbendiT(path : string;ParentNode: TTreeNode);
var
SearchRec : TSearchRec;
IFound , ArrX,jj : integer;
newnode : TTreeNode;
begin
ArrX:=0;
IFound := FindFirst(Path + '/*.*', $3F, SearchRec);
While IFound = 0 do
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
begin
if SearchRec.Attr = faDirectory then
begin
newnode := Ftvbendi.Items.AddChild(ParentNode, SearchRec.Name);
addbendiT(Path + '/' + SearchRec.Name, newnode);
end
else
//ÅжϺó׺ÃûÏÔʾ
//AnsiMatchText ·µ»Ø×Ö·û´®Êý×éAValuesÖÐÊÇ·ñ°üº¬×Ö·û´®AText
//showmessage(ExtractFilename(searchrec.Name));
if AnsiMatchText(ExtractFileExt(searchrec.Name),['.3bc','.3HC','.QDC','.GJC','.WDC','.GLC','.ZLC','.ZZC','.RJC']) then
begin
showmessage(ExtractFileExt(searchrec.Name));
Filename:=Searchrec.Name ;
StringGD(ExtractFilename(searchrec.Name),ArrX);
showmessage('kk');
Ftvbendi.Items.AddChild(ParentNode, SearchRec.name);
end;
//if ExtractfileExt(Searchrec.Name)in
end;
IFound := FindNext(SearchRec);
end;
Findclose(SearchRec.Attr);
end;
备注:
<<Delphi6函数大全1-StrUtils.pas>>
首部 function AnsiMatchText(const AText: string; const AValues: array of string): Boolean; $[StrUtils.pas
功能 返回字符串数组AValues中是否包含字符串AText
说明 不区分大小写
参考 function StrUtils.AnsiIndexText
例子 CheckBox1.Checked := AnsiMatchText(Edit1.Text, ['a1', 'a2', 'a3', 'a4']);
看看这样行么!!!!!!