Egor Pavlikhin
Egor Pavlikhin

Reputation: 17981

FileSystemWatcher OnOpened event

In .Net how can I monitor if a file has been accessed (opened) by other programs? I can't see OnOpened event in FileSystemWatcher, so I assume it can not do that. Is there any other way to do it? It's clearly possible in Windows, is there some sort of hook available from .Net?

Upvotes: 3

Views: 169

Answers (2)

sszarek
sszarek

Reputation: 424

NotifyFilters enumeration has interesting you value: LastAccess indicating last file or directory access. This has to be set to the NotifyFilter property.

Upvotes: 2

SRM
SRM

Reputation: 1377

Check out the NotifyFilters property. You probably want to look for changes in access date/time.

Upvotes: 4

Related Questions