How to detect that file\folder is being accessed or not?

For example if anyone just visited(and not making any changes) E:\Documents how can i detect that ? i tried ReadDirectoryChanges() but it detects changes only if something is modified inside the folder.
Last edited on
What do you mean by "visit"? Is this with Explorer? Or??

ReadDirectoryChanges (sort of) works for me -- with FILE_NOTIFY_CHANGE_LAST_ACCESS -- when I use Explorer to visit the folder (as it looks at one of the files, when it changes to a new folder?), but not if I use the console (i.e. cd to directory and use dir.)

Does it not work at all for you?

Andy
Last edited on
By "visit" i mean if anyone tries to see the content of the directory (list files and folders, for example if i double click on folder and see whats inside from explorer or dir (or cd [target folder] ) command from console).

i tried FILE_NOTIFY_CHANGE_LAST_ACCESS, it was not showing any notification when i accessed the target folder from explorer or console.
Last edited on
I've had another look.

When I navigated to a folder using Explorer, my test program was detecting something's happened. But I now see it's because something (my virus scanner?) is checking the binary files which are found there, not because of the change of folder.

I used a folder where I keep all my test apps for the testing, which was a mistake. Using a different folder which just contains text files, the app doesn't trigger.

So, unfortuately, I don't have the "fix" I hoped I had! :-(

Andy
Is there any other way to achieve the same goal ? another function beside ReadDiretoryChanges from api or any other technique?
Well, I don't know of one.

If no one else responds here, and Google has already failed you, you could try posting to the appropriate Microsoft forum?

Andy
Topic archived. No new replies allowed.