Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Feb : Threaded FindFirstChangeNotification

www.cryer.info
Managed Newsgroup Archive

Threaded FindFirstChangeNotification

Subject:Threaded FindFirstChangeNotification
Posted by:"Dixon Epperson" (edeppers..@insightbb.com)
Date:Fri, 18 Feb 2005 11:56:35 -0500

I have a thread that monitors a folder for new files,  using
FindFirstChangeNotification, FindNext... and FindClose....

I use WaitForSingleObjectEx to be signaled and a Syncronized callback to
notify the main app and refresh the gui.

It seems to work ok when we just have one folder to monitor

My question is could I safely monitor 3 folders, not in the same tree by
giving each a separate handle in the
FindFirstChangeNotification and then do something like this:

    vRslt := WaitForSingleObjectEx(vHndle1, 1000, True) or
WaitForSingleObjectEx(vHndle2, 1000, True) or WaitForSingleObjectEx(vHndle3,
1000, True)
    if not Terminated then
    begin
      if vRslt = WAIT_OBJECT_0  then
      try
      finally
      end
    end;

I suspose I could do a thread for each folder I want to monitor, but I am
really looking for the most efficient way to do this.

E. D. Epperson Jr.

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive