A little while ago I was looking at doing something similar in VFP. There is a VFP Solutions example based on the Win32 API ShChangeNotifyRegister function. I was warned there are some potential issues with this e.g.
1. Combined notifications:
http://msdn.microsoft.com/en-us/library/bb762120%28VS.85%29.aspx2. Possible deprecation on current/future OSs (i.e. Vista and later):
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/75fab037-f31e-4cbc-8b64-bb0e6f339f75Why is this relevant to you? *If* the .Net functions are wrappers around these API functions they may exhibit some of the same foibles. Even if they aren't, it might be worth asking around regarding any gotchas.
I ended up using ADIR() fired by a timer. In my case, a video can start being written (real-time capture) to a folder, but not be finished for a minute or two. I check for the capture being finished by periodically attempting to obtain a file lock via FOPEN().
In your case, what you may need to look for is some sort of "lock released" event on a file that you know has just been created (if such an event exists). If an event like that doesn't exist, you might have to try a looped/timered low level file open, like I did in VFP. My understanding is, at the basic file system level, the only way you can be sure that another process isn't using a file (or is finished using it) is if
you can obtain exclusive access.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up