Reputation: 39
I want to execute some C# method when a user opens a folder in Windows Explorer.
How to do such a thing?
Upvotes: 1
Views: 218
Reputation: 6612
I am not sure about this but this is what I would do/try,
have a C# program which starts up on logon Open C# application on log on or just have your program running in some way and use FileSystemWatcher Class you can make use of LastAccess notify filter and have your C# code get executed .
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = "folder path";
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess;
// add event handler
Hope this helps.
Upvotes: 1