Monitor file selection in explorer (like clipboard monitoring) in C#

孤街醉人 提交于 2019-12-03 21:45:49

You can do this with the shell automation interfaces. The basic process is to

  1. Run Tlbimp on Shdocwv.dll and Shell32.dll (or directly add a reference from VS).
  2. Create an instance of the ShellWindows collection and iterate. This will contain both Windows Explorer and Internet Explorer windows.
  3. For Windows Explorer windows, the IWebBrowser2.Document property will return a IShellFolderViewDual reference.
  4. The IShellFolderViewDual has a SelectedItems method you can query and an event for changes you can handle.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!