I have used FileSystemWatcher to detect changes in a folder set and it's great but I'm presently expanding my application and I need to detect when a user opens a file. The FileSystemWatcher seems to imply that with the NotifyFilter you can specify to fire the Changed event on a LastAccess change. Should this not cause the event to fire on a file open. This is not happening for me does anyone know what I'm doing wrong. Here is a code snippet to show how I'm doing it.
watcher1.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.Attributes | NotifyFilters.LastAccess;
watcher1.Filter = "*.*";
watcher1.IncludeSubdirectories = true;
// Add event handlers.
watcher1.Changed += new FileSystemEventHandler(OnChanged);
Is this possible ? If not does anyone know of a way to do this effectively. My problem is that the watcher could be looking at 100's or 1000's of files in nested folder so I don't want it to have to poll them all to see are they open as this would gobble up resources on the machine. My application is a background application.
Thanks in Advance