问题
I would like to write a shell extensions to completely customize the display of a particular folder, ala the Assembly Cache Viewer (browse to c:\windows\assembly and you will see what I mean). Which COM interfaces are responsible for providing these hooks? My 'viewer' will be written in C#...
Thanks!
回答1:
Here's an article that should get you on your way:
- Create Namespace Extensions for Windows Explorer with the .NET Framework
Extending the Windows shell with namespace extensions allows you to create some custom functionality for Windows Explorer. One common use is to enable Explorer to present a list of items that do not exist in one real folder, but actually reside in a number of places. The view on the folder makes it look like these items are in one place, so managing them becomes easier. This article illustrates the process of creating custom shell namespace extensions using C# and the .NET Framework. [...]
回答2:
Note that there is controversy about doing explorer extensions in .NET.
Example problem: If you target .NET 2.0, then your extension won't work in any "open file" dialogs shown by .NET 1.1 applications. A process can load only one version of the .NET runtime.
It's not just a matter of your extension not working; you will be injecting a particular version of the .NET runtime into any application that uses file dialogs. That's bad news if the app is an unmanaged application that was planning on loading a COM component targetting a newer version of the .NET runtime, etc.
edit: as explained in the comment, this has now been solved by the .NET 4.0 runtime. Therefore, managed explorer extensions should always target .NET 4.0 or later.
来源:https://stackoverflow.com/questions/1408411/writing-a-windows-shell-extension-similiar-to-the-assembly-cache-viewer