Search code examples
winapipollingevent-driven

Watching a folder using Win32


I'm looking for a straightforward way to watch the contents of a folder using Win32 (minimum target is XP). If possible, it would be nice to use an event-driven approach rather than a polling-type approach. To complicate things, the watched folder may be a network share.

I'm really only interested in capturing "new files". I don't care if I am not informed of renamed or removed files.

Is there an event-driven way, or is polling my only choice when dealing with Win32?


Solution

  • Have you tried out FindFirstChangeNotification and FindNextChangeNotification . Download an example source code from here