如何获取一个文件夹下面的所有子文件名,并将它子文件名一一列在一个窗口上 ?请各位大虾帮帮忙!
解决方案 »
- 当打开一个文件时,怎么样才能获得这个文件的图标
- DLL 动态连接库调用问题.
- Delphi,,,也许是老了
- 关于网络文件复制的问题。急呀。在线等,可以就给就。
- 请问当下比较流行的超级记事本如EditPlus,它们用的是什么控件?
- 请问:在按回车键的时候,怎么样才能让焦点从dbgrid一个的一个列里移到下一列里???
- 将数据库中bmp图片显示在image上
- 控制ScrollBox的滚动条,设定滚动条的位置,滚动条改变但ScrollBox的当前位置没改变?
- TMD,问题到底在哪里啊。劳驾各位看看下面的程序。
- query控件的edit方法究竟在什么情况下能用啊
- 自认为是高难度问题,高手请进,看是否有办法解决,谢谢!
- 在数据更新时候,如何让他立即停止呢?
function SearchFile(const mainpath:string;filename:string;var foundresult:TStrings):Boolean;
var
i:integer;
Found:Boolean;
subdir1:TStrings;
searchRec:TsearchRec;
SR : TSearchRec;
begin
found:=false;
if Trim(filename)<>'' then
begin
if FindFirst(mainpath+filename,faDirectory,sr)=0 then
repeat
begin
found:=true;
foundresult.Add(mainpath+SR.Name);
end
until FindNext(sr)<>0;
FindClose(SR); if FindFirst(mainpath+'*.*', faDirectory, SearchRec)=0 then
begin
while FindNext(SearchRec) = 0 do
begin
if SearchRec.Name<>'..' then
begin
found := SearchFile(mainpath+SearchRec.Name+'\',Filename,foundresult)or found;
end;
end;
end;
FindClose(SearchRec);
end;
result:=Found;
end;
var
FSearchRec,DSearchRec:TSearchRec;
FindResult:integer;
begin
if apath[length(apath)]<>'\' then apath:=apath+'\';
FindResult:=FindFirst(Apath+'*.*',faAnyFile+faHidden+faSysFile+faReadOnly,FSearchRec);
try
while FindResult=0 do
begin
ListBox1.Items.Add(Apath+FSearchRec.Name);
FindResult:=FindNext(FSearchRec);
end;
FindResult:=FindFirst(Apath+'*.*',faDirectory,DSearchRec );
while FindResult =0 do
begin
if ((DSearchRec.Attr and fadirectory)=fadirectory) and (leftstr(DSearchRec.Name,1)<>'.') then
FindFiles(Apath+DSearchRec.Name);
FindResult:=FindNext(DSearchRec );
end;
finally
FindClose(FSearchRec);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
FindFiles('D:\test\');
end;
*TryMyBestToKnowSomethingAboutEverythingAndEverythingAboutSomething!
********************************************************************
Delphi自己的FindFirst就不支持的_____________________
http://lysoft.7u7.net