Thanks David, you are right. :)
First I totally misundrestood the question. And then I gave him an outdated
answer.
AliR.
"AliR (VC++ MVP)" <AliR@online.nospam> wrote in message
news:3ARBj.13875$5K1.10403@newssvr12.news.prodigy.net...
If I was doing a directory watcher I would create a thread that would use
FindFirstChangeNotification, this function returns a handle that you can
wait on (WaitForSingleObject, WaitForMultipleObjects), when something
changes your wait with get signaled.
There are also a bunch more stuff you can monitor, see the help for
FindFirstChangeNotification.
These API's have the advantage of working on Win9x. But they have the
disadvantage that they provide less info when the event occurs. For
example, if a file is added or deleted from a watched folder, you get an
event, "Hey, a file is added or deleted." But it doesn't tell you the
filename of that file... how lame is that? You have to keep your own
cache of existing files and compare that to the new state when you get an
event; then you can tell by the difference which file(s) were added or
deleted. Which is not much better than polling.
That's why on NT-based systems, ReadDirectoryChangesW() is better.
-- David