TIP: Click on subject to list as thread! ANSI
echo: delphi
to: STEVE BATSON
from: OLE ALMIND MORTENSEN
date: 1996-05-25 10:50:00
subject: Delphi Bug

Hello Steve!
Wednesday May 22 1996, Steve Batson wrote to All:
-----------------------------------------------------------------------------
 function FileCount(PathString : string) : integer;
 var
   SearchRec : TSearchRec;
   Ctr : integer;
   RetCode : integer;
 begin
>   Ctr:=-1; {subtract Directory count from number}
   RetCode := FindFirst(PathString + '\*.*',FaAnyFile,SearchRec);
   While FindNext(SearchRec) = 0 do
     begin
       Application.ProcessMessages;
       Ctr:=Ctr+1;
    end;
      SysUtils.FindClose(SearchRec);
      FileCount:=Ctr;
 end;
-------------------------------------------------------------------------
You don't need to do that!
Just use:
Findfirst(Pathstring+'\*.*',FaAnyfile-FaDirectory,Searchrec);
Remember to check that Pathstring isn't d:\ or another root dir, because if 
it is you will now be searching for D:\\*.*, and you do not find too many 
files that way. :)
Tip:
-----------------
If Pathstring[4]='' then
  Begin
    Findfirst(pathstring+'*.*',faanyfile-fadirectory,Searchrec);
  End
Else
  Begin
    Findfirst(pathstring+'\*.*',FaAnyfile-FaDirectory,Searchrec);
  End;
----------------
 SB> Well, I hope this helps someone.
It was something in your code, which helped me, so thanks alot. :)))
Hope you can use of that i wrote to you.
Kind regards
Ole
... Try out Check210.Zip & Fm091.Zip
--- GoldED/386 3.00.Alpha1+ /FrontDoor 2.12
---------------
* Origin: P5 100, 16Mb/2Gb, LBP-4u, SG32+, 4x CD, 28K8 (2:237/10.150)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.