就是用FindFirst,FindNext递归啊。为了效率,你可以用*.*通配符把所有文件名读入到一个StringList中,然后在这个StringList里面查找你需要的文件名
解决方案 »
- 第三次执行创建出错
- sql语句中不让用dayoftheweek函数?????
- 一條復合循環語句:本人在編寫一個關於海關品名的程序,即將成功,但在取詞時,不知如何整理和寫好這條循環代碼?
- 如何用程序取消excel的行隐藏?
- 请高手指点迷津-关于DELPHI调用WORD编程
- 如何在MDI的某一子窗口已经最大化的情况下,非最大化显示另一个子窗口?Help Me.
- 100分~~谁知道进销存怎么做?
- 按条件执行触发器
- 帮我解决立即给你我的全部分数
- 用Tquery控件做数据库程序,在用insert语句时有问题,具体请进!
- 打印求救:如何用Pdevmode来设置打印机的各项参数。100哪!
- 一个让我晕的问题,有关socket和指针。
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; if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then begin
with StringGrid1 do
begin
if (sr.Attr and FileAttrs) = sr.Attr then
begin
Cells[1,RowCount-1] := sr.Name;
Cells[2,RowCount-1] := IntToStr(sr.Size);
end;
while FindNext(sr) = 0 do
begin
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;
end;
FindClose(sr);
end;
end;
end;