delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
findfirst findnext 递归查找指定目录下所有子目录下所有文件,为什么总是死机? Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiAPI/html/delphi_20061110231617254.html
procedure   TForm1.FindAll(const   Path:   String);  
  var  
      sr:TSearchRec;  
      fr:Integer;  
  begin  
  fr:=FindFirst(Path,faAnyFile,sr);  
  while   fr=0   do  
      begin  
      if   (sr.Attr=faDirectory)and(sr.Name<>'.')and(sr.Name<>'..')   then  
          FindAll(sr.Name)      
      else  
          begin  
            showmessage(sr.name);  
          end;  
      FindNext(sr);  
      end;  
  FindClose(sr);  
  end;  
   
  我是从网上找到的这个函数,可是调用时总是不停时showmessage,一直停不下来,这是为什么呢?万分感谢!

FindNext(sr);  
  改为:  
  fr:=FindNext(sr);  
   
   
  //别人为你消耗时间和生命  
  //你却什么都不付出,很不厚道。  
  //记得下次改正。

posted on 2009-04-08 09:10 delphi2007 阅读(648) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。