ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Coding Snacks

Another Right-Click Menu question (except different)


I want to remove/disable the "CUT", "DELETE" and "RENAME" items from the right menu choices depending on certain rules (i.e. contents of folders, file path, only for certain directories).  The best example I can give is the way that TortoiseSVN alters the menu depending on if the item is added to the repository or not.  I've looked into the TSVN code and found some useful stuff but I'm unclear how it all ties together.  I've found where the items are added to the registry but I'm missing the "rule" functionality that is used to determine when to alter the menu.  I'm open to all ideas.

I've tried most the apps suggested in other topics with no avail.

Lammer Context Menu
FileMenu Tools
Right Click Enhancer
(and a few others that are slipping my mind right now)


I don't think you can apply rules to the standard system items. You can edit the registry or use a tool to put them in the Right Click Menu or Shift Right Click Menu.

Otherwise each individual file type you are going to handle you have to write an IContextMenu handler(.dll.) When Windows calls your QueryContextMenu function, you would do whatever and decide if you want to put your commands in the menu.  Way too much work.

That's probably why you don't see any canned utilities doing it. Someone who writes a program with a dedicated file type(extension) may do some fancy stuff in the context menu handler if the program has shell integration. But to do it for the hundreds of file types registered... Windows will probably be only in museums before that happens.


[0] Message Index

Go to full version