Add a context menu item in windows explorer only for a specifc drive

I would like to add a context menu item in windows explorer, a bit like notepadd++, winzip, winrar.

These are my requirements :

After a bit of searching, it looks as though I could use the HKEY_CLASSES_ROOT\Folder\shell registry key and plug myself here but it looks as though it's all or nothing, no way to have my item just in the context menu for files in D: but not C:

The other solution would be to write a Shell Extension, but this is discouraged in .NET, and looks a bit overkill for the task at hand.

What is the simplest way to solve my problem ?

Thanks

Upvotes: 2

Views: 817

Answers (1)

Davide Piras
Davide Piras

Reputation: 44605

The other solution would be to write a Shell Extension, but this is discouraged in .NET, and looks a bit overkill for the task at hand.

where did you read it is discouraged? Dino Esposito has written a whole book on Shell Extensions done in C#, google for it :)

in a ShellExtension your code is executed and you have full control on what to display and when, it's not overkilling is what you need in this case.

The registry contains the ShellExtension registration (plus other things), so I believe you should go for coded shell extension approach not touching the registry manually because in this second case you have less control on what happens.

Upvotes: 1

Related Questions