2013-02-11 155 views
1

我想在用戶在Windows資源管理器中打開文件夾時執行一些C#方法。當Windows資源管理器打開給定文件夾時調用方法

如何做這樣的事情?

+0

自動啓動的Windows服務。在所有當前正在執行的進程中使用計時器跟蹤並查找包含所需文件夾的標題的iexplorer.exe進程。 – 2013-02-11 13:05:28

+2

僅僅因爲答案可能是「不」,這並不意味着這個問題是模糊的,模糊的,不完整的,過於寬泛的或修辭的。 – dtb 2013-02-11 13:22:48

+0

也許這些會幫助你:[1](http://stackoverflow.com/q/7479583/290343),[2](http://social.technet.microsoft.com/Forums/en-ZA/ITCG/線程/ ae676f12-fff7-4efe-b438-e12ac5f1ff4b) – 2013-02-13 03:18:04

回答

1

我不知道這個,但是這是我會做/嘗試,

具有上登錄Open C# application on log on啓動或只是讓你的程序以某種方式運行,並使用FileSystemWatcher Class你可以使用C#程序LastAccess通知過濾器並讓您的C#代碼得到執行。

// 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 

希望這會有所幫助。

+0

這不會告訴您文件夾是由Windows資源管理器打開還是由某個任意進程訪問。 – 2013-02-13 05:17:07

相關問題