1

I want to execute some C# method when a user opens a folder in Windows Explorer.

How to do such a thing?

Ofer Zelig
  • 17,068
  • 9
  • 59
  • 93
  • Windows Service that is auto started. Keep track using a timer over all currently executing processes and look for iexplorer.exe process with title containing the desired folder. – Shadow The GPT Wizard Feb 11 '13 at 13:05
  • 2
    Just because the answer is likely "no" it doesn't mean that the question is ambiguous, vague, incomplete, overly broad, or rhetorical. – dtb Feb 11 '13 at 13:22
  • Maybe these will help you: [1](http://stackoverflow.com/q/7479583/290343), [2](http://social.technet.microsoft.com/Forums/en-ZA/ITCG/thread/ae676f12-fff7-4efe-b438-e12ac5f1ff4b) – Ofer Zelig Feb 13 '13 at 03:18
  • May be try with this http://stackoverflow.com/questions/2118452/how-to-identify-whether-folder-is-opened and implement a funtion within this. – coder Feb 13 '13 at 03:18

1 Answers1

1

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.

DotNetUser
  • 6,494
  • 1
  • 25
  • 27
  • That doesn't tell you if the folder was opened by Windows Explorer or just accessed by some arbitary process. – Ofer Zelig Feb 13 '13 at 05:17