views:

474

answers:

2

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!

+2  A: 

Here's an article that should get you on your way:

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. [...]

dtb
I have tried this code... and used it by calling:ShellFolder.RegisterFunction(typeof(Class1));But it doesnt appear to do anything... does it not work on Vista?
Adam
+5  A: 

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.

Wim Coenen
The latest .Net 4.0 runtime supports in process side-by-side loading of the .Net 4.0 runtime (and ALL future runtimes) with earlier .Net runtimes.See following excerpt from http://msdn.microsoft.com/en-us/magazine/ee819091.aspx "With the ability to have multiple runtimes in process with any other runtime, we can now offer general support for writing managed shell extensions—even those that run in-process with arbitrary applications on the machine."
logicnp