## TFindFile and WaitFor

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

### TFindFile and WaitFor

First, thanks for this awesome component!!!

I'm trying to perform several different task using one FindFile component. This FindFile created run-time. Let's see this execute pseudocode:

Code: Select all
for i := Low(Task) to High(Task) do begin  FindFile.Threaded := True; { must }  FindFile.Criteria...  FindFile.OnFileMatch := ...  ...  FindFile.Execute;end;

Since the FindFile are in threaded mode, so this "for" routine is not working properly. Is there any clue about WaitFor method that can be used so this kind of loop routine able to do its job, and without having to make the main thread (main form) hang?

Kimbo
Member

Posts: 1
Joined: August 28th, 2012, 3:44 am

### Re: TFindFile and WaitFor

WaitFor blocks the calling thread anyway.
Instead of using a single instance of TFindFile to run the tasks one by one, I do suggest to create a new threaded instance of TFindFile for each task, so you can do all tasks simultaneously.
Kambiz

Kambiz