views:

42

answers:

1

Is there any way I can extend or modify the behavior of Windows Explorer click?

For example, I want to modify the the click event. On clicking a drive, I should be able to connect to an FTP server instead of opening the drive. The drive will be a mounted drive.

So what I want to do is modify the default behavior of Windows Explorer Click or Extending the Behaviour of Shell (I'm not sure if this belongs to shell extension).

+1  A: 

Hmya, this is quite a bit beyond "click". You'd have to write a shell extension. Doing this in C# was quite off limits until .NET 4.0 because of the CLR version injection problem. Unmanaged programs (say, Notepad) would get the CLR injected in them when they use a shell dialog, like FolderBrowser or OpenFileDialog. Which could cause subsequent code to fail that requires another version of the CLR. That's solved, CLR 4.0 supports in-memory side-by-side operation of multiple CLR versions.

What isn't solved is the complexity of the code you'd need to write. Shell extensions require COM code. The hard kind, interfaces that derive from IUnknown. To even get started, you need to write masses of declarations for the COM interfaces. You can't get them out of the SDK declarations, they are only usable by a C++ program. And it is very error prone, C# doesn't support multiple inheritance, the feature you'd need to declare COM interfaces that are derived from other interfaces.

Last but not least, debugging this kind of code is a nightmare. This is an essential Windows process you're tinkering with. Making a mistake leaves you with an unusable shell. Rebooting starts that same borked shell.

Well, black-belt skills required. I imagined that the availability of .NET 4.0 should have jump-started some projects that provide friendly managed wrappers. I just haven't seen any yet. Take that as a sign as well.

Hans Passant