Disable contextmenu item on desktop background of Windows

0

2

Scenario

I'm using Windows 10, but I have the same problem In other Windows versions.

I've added a custom item in my Windows contextmenu, it is intended to be accesible by right-clicking from a directory folder, or from a directory background.

This registry script reproduces my custom contextmenu item (except the subcommands):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\PATHS]
"MUIVerb"="PATHS"
"SubCommands"="PATHS.AddDirBackground;PATHS.RemoveDirBackground"
"Icon"="C:\\Program Files\\PATHS\\PATHS.Title.ico"
"Position"="bottom"

[HKEY_CLASSES_ROOT\Directory\Background\shell\PATHS]
"MUIVerb"="PATHS"
"SubCommands"="PATHS.AddDirBackground;PATHS.RemoveDirBackground"
"Icon"="C:\\Program Files\\PATHS\\PATHS.Title.ico"
"Position"="bottom"

enter image description here


Problem

The problem I have is that Windows seems to treat the desktop background in the same way as a directory background, so my custom contextmenu item is visible when I do right-click on the desktop background:

I don't like this behavior, because this contextmenu item isn't useful when accesible from the desktop background, it only increases the size of the desktop contextmenu in general.


Question

How I could disable my contextmenu item from still appearing on the contextmenu of the desktop background?.

Please note that its a simple contextmenu item manually added via registry, I don't pretend to rework the implementation via shell extension.


Research

In this article I seen a natural methodology or hack to hide or disable any contextmenu item:

enter image description here

However, I'm not sure how to do it neither if that is really what I need.

I tried to add a "ghost" item on the DesktopBackground registry key trying to override the original item that I have on Directory\Background key, but the item still shown when I do right-click on the desktop background:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\DesktopBackground\shell\PATHS]
"MUIVerb"="PATHS"
"LegacyDisable"=""

Or:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\DesktopBackground\shell\PATHS]
"MUIVerb"="PATHS"
"Extended"=""

On the other hand, the trick works ok for the original items that are stored in the registry keys mentioned above, but this trick doesn't works for this "ghost" or "dummy" item which is the one that I want to hide from contextmenu.

ElektroStudios

Posted 2015-10-13T14:46:30.763

Reputation: 1 282

3What made you think the desktop was different from a folder? Your Desktop itself is an interface to the contents of a specific folder. What you want to have happen goes against the base core concept of Windows as an operating system – Ramhound – 2015-10-13T15:13:21.820

What made you think the desktop was different from a folder? Here is the big difference: HKCL\DesktopBackground\Shell vs. HKCL\Directory\Background\Shell there is one key for desktop shell menu, and one different key for directory shell menu. You said it yourself, it is an iterface, and that means it is not treated in the same way as any other folder because it is a different "representation" with a GUI that covers the screen. Anyways, I think we are not here to discuss what is a desktop environment. At least not in that way... thanks for comment. – ElektroStudios – 2015-10-13T15:20:11.837

It will be ok If I manually navigate through Explorer to the desktop folder then I do a right-click on its folder background, which is not the same thing as doing a right-click on the desktop background. – ElektroStudios – 2015-10-13T15:24:29.643

1It's still a folder. Which is obvious if you open explorer and look for it. It contains other folders and shortcuts. – DavidPostill – 2015-10-13T15:25:23.967

@DavidPostill Yes its an (user)folder,of course,that was clear from the start.The thing I mean is that HKCL\DesktopBackground\Shell items only affects to the desktop background, while HKCL\Directory\Background\Shell affects to folders background (including the desktop folder), then, there exists a difference between items on one place or the other place, and In my question I'm trying to ask if exist a way to avoid an item placed in HKCL\Directory\Background\Shell still affects in the desktop background, by disabling it in some way in the desktop background contextmenu.Thanks for comment – ElektroStudios – 2015-10-13T15:33:32.370

No; Since the Desktop is a folder, the key to add context menus on a right click action within a folder, is going to always affect the right click context menu on the desktop. You should clarify what you mean by "but this does just nothing of nothing" because that statement isn't clear. – Ramhound – 2015-10-13T15:34:57.010

@Ramhound Yes unfortunately I noted that, but I wonder whether I could override/supplant the cm item stored in HKCL\Directory\Background\Shell by duplicating it in HKCL\DesktopBackground\Shell to disable it in the way I mention in the Research section of my question. That could be a good approach if it could be possibly to do (maybe Its possible and I just missed to add some reg value) but as I mentioned when I try to duplicate that item, seems that the item placed inHKCL\Directory\Background\Shell takes priority because is still shown. Thanks for comment. – ElektroStudios – 2015-10-13T15:40:16.917

I would assume you have tried that and determined that won't work – Ramhound – 2015-10-13T15:41:02.433

With "but this does just nothing of nothing" I mean the contextmenu behavior doesn't changes, the item does not becomes hidden when I do right-click on the desktop background, the item still shown. – ElektroStudios – 2015-10-13T15:42:53.510

@ElektroStudios - Say what you mean. What you actually have said is not clear, is not proper English, and is confusing. – Ramhound – 2015-10-13T16:18:32.107

@Ramhound Please say what you don't understand from my intentions and I will try to express it in proper English. anyways, there is a thing you could do to understand what I mean. 1st: Copy the first registry script of my question and test/install it. 2nd: Do the same with the last script I gave (the "dummy" and disabled contextmenu item), and see what happens, happens nothing of nothing because the item still visible on contextnenu. – ElektroStudios – 2015-10-13T17:40:37.907

1@ElektroStudios - I was very clear. When you say "nothing of nothing", that statement is not clear, it isn't even proper English. You have already indicate what it means, so I indicate you should say that, and not "nothing of nothing". – Ramhound – 2015-10-13T17:46:19.670

1This is quite a tedious question, honestly. As already developed, the Desktop is (just) an interface for a folder. If the functionality of your context menu item is pointless on the Desktop then just don't use it. – Insane – 2015-10-13T23:05:07.467

No answers