把一个文件夹中
获取第一层子文件夹名
列出来
先谢谢了!
获取第一层子文件夹名
列出来
先谢谢了!
解决方案 »
- 求教,怎么让某个控件无法获得焦点?
- 寻现在在淄博或东营的delphi高手,有一小项目
- 有谁用过CPT 8000 欣数据采集器?如何对它编程?谁有这方面的例子?
- 如何取到另一个程序里EDIT1的内容啊。
- 请问如何判断Excel文件中的当前行是否被使用?
- 为何小妹【在用install shield express for delphi4打包时不能设置别名参数】
- 在delphi下运行程序时,有时候会出现Access violation at address 77FA1032 in module 'ntdll.dll'. Write of address 00000030错误
- 路过的,过来看看啊
- 有几个关于类的概念想请叫大家
- 哪里有制作.Chm文件的软件,最好是有中文版的
- 请大家帮忙一个'花生壳'的问题
- 如何 把进度条 弄成像Windows 开机时那 滚动的进度条
FindNext
帮助自带的例子procedure TForm1.Button1Click(Sender: TObject);var
sr: TSearchRec;
FileAttrs: Integer;
begin
StringGrid1.RowCount := 1;
if CheckBox1.Checked then
FileAttrs := faReadOnly
else
FileAttrs := 0;
if CheckBox2.Checked then
FileAttrs := FileAttrs + faHidden;
if CheckBox3.Checked then
FileAttrs := FileAttrs + faSysFile;
if CheckBox4.Checked then
FileAttrs := FileAttrs + faVolumeID;
if CheckBox5.Checked then FileAttrs := FileAttrs + faDirectory;
if CheckBox6.Checked then
FileAttrs := FileAttrs + faArchive;
if CheckBox7.Checked then FileAttrs := FileAttrs + faAnyFile; with StringGrid1 do
begin
RowCount := 0; if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then begin
repeat
if (sr.Attr and FileAttrs) = sr.Attr then
begin
RowCount := RowCount + 1;
Cells[1,RowCount-1] := sr.Name;
Cells[2,RowCount-1] := IntToStr(sr.Size);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
end;
function TForm1.IsValidDir(SearchRec: TSearchRec): Boolean;
begin
if (SearchRec.Attr = 16) and (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
Result := True
else
Result := False;
end;procedure TForm1.FindSubDir(DirName: string);
var
searchRec: TsearchRec;
begin
//找出所有下级子目录。
if (FindFirst(DirName + '*.*', faDirectory, SearchRec) = 0) then
begin
if IsValidDir(SearchRec) then
ListBox1.Items.Add(SearchRec.Name);
while (FindNext(SearchRec) = 0) do
begin
if IsValidDir(SearchRec) then
ListBox1.Items.Add(SearchRec.Name);
end;
end;
FindClose(SearchRec);
end;