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);  
   
   
  //别人为你消耗时间和生命  
  //你却什么都不付出,很不厚道。  
  //记得下次改正。

相关文章:

  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-12-31
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案