关于文件搜索的问题和一个关于listview的问题 在线等!!!!
procedure TFormOfMain.ShellTreeViewChange(Sender: TObject;
Node: TTreeNode);
var newitem:tlistitem;
str,strpath:string;
srec:tsearchrec;
flag:integer;
begin
listview1.Items.Clear;
//获取shelltreeview目录路径
strpath:=shelltreeview.Path+'\'+'*.*';
//找到第一条数据
flag:=findfirst(strpath,faanyfile,srec);
//先判断是否找到了第一条数据
if flag=0 then
begin
//将找到的数据加入tlistview
newitem:=listview1.Items.Add;
newitem.Caption:=srec.Name;
newitem.SubItems.Add(inttostr(srec.Size));
newitem.SubItems.Add(datetimetostr(filedatetodatetime(srec.Time)));
if srec.Attr=16 then newitem.ImageIndex:=1;//是目录
while (findnext(srec)=0)do
begin
newitem:=listview1.Items.Add;
newitem.Caption:=srec.Name;
newitem.SubItems.Add(inttostr(srec.Size));
newitem.SubItems.Add(datetimetostr(filedatetodatetime(srec.Time)));
if srec.Attr=16 then newitem.ImageIndex:=1;
end;
end;
listview1.AlphaSort;
end;
我将在shelltreeview选中的目录下的文件搜索出来放到listview中
如果我想只搜索doc+txt类型的文件
strpath:=shelltreeview.Path+'\'+'*.*';这条语句应该怎么改呢
我试过
strpath:=shelltreeview.Path+'\'+'*.doc'+':*.txt';
strpath:=shelltreeview.Path+'\'+'*.doc:*.txt';
strpath:=shelltreeview.Path+'\'+'*.doc,*.txt';
strpath:=shelltreeview.Path+'\'+'*.doc|*.txt';
全部不行
请问大家应该怎么弄啊
还有就是我把文件放到listview里以后 有没什么办法能让文件的图片显示在文件名前面啊?
本来想用shelllistview的 但shelllistview上面的导航条实在是没办法改 只能选择了listview