Jump to content

Disable Windows Context Menu Entry


Recommended Posts

Hello Guys,

I was looking for a way to disable a Windows Context Menu Entry (not delete it!). So that it's not clickable and greyed out, like the "Empty Recycle Bin" Entry when the Recycle Bin is empty ..
I did a lot of reseach, but all I could find was this one: 

 But it doesn't work for me ..
I also took a look at this one: 

But I wasn't able to properly run it on Windows 10 x64. So it was no help either ..
I need a command to simply disable and enable the Entry. :/

Any ideas on this one? :)

Link to comment
Share on other sites

25 minutes ago, Leo1906 said:

Any ideas on this one? :)

You could set up a toggle script that RegDeletes the entry and RegWrites it back when needed.

Not sure how Win 10's safety features will react to registry hacks though...

Edited by l3ill
Link to comment
Share on other sites

1 minute ago, l3ill said:

You could set up a toggle script that RegDeletes the entry and RegWrites it back when needed.

Not sure how Win 10's safety features will react to registry hacks though...

Yeah I could do that real easy, but thats not what I want. I don't want to delete the entry. It should be shown but not accessable until enabled ..

Link to comment
Share on other sites

Just now, AutoBert said:
GUICtrlSetState($idOfCtrl,$GUI_DISABLE)

should work also under win10 x 64.  Make a small runable reproducer, shows your issue(s).

I don't think this works, because I'm not having a GUI myself. I'm using the Windows Right-Click Menu (Context Menu) and add my entries with RegWrite.

Or how do I get the ID of the Context Menu Control?

Link to comment
Share on other sites

1 minute ago, AutoBert said:

If not for a own GUI use Au3Info to get the informations about the Window and the control.

It's not that I don't know about those things .. But tell me, how do you use the tool on the Right-Click menu, when it vanishes if you click somewhere else ..?
And as well I don't think it's possible to just use GuiCtrlSetState on a control like this. I would think it is redrawn on every opening of the menu.

I think that this here is the right way: 

Especially this line: 

DllCall("EnableMenuItem", "UInt", MenuID, "UInt", A_Index-1, "UInt", MF_BYPOSITION | MF_GRAYED)

The MF_GRAYED looks exactly like what I want. But I can't get it to run for me.

Link to comment
Share on other sites

2 hours ago, l3ill said:

There should be a way to update a registry entry with these parameters.

AppendMenu function

I cant play with the registry here at work :mad:

Yeah, this seems to be the right way. Unfortunately my skills are fare to low to implement this.
The article states that the user32.dll has to be called, just like the example in the thread given above does ..?

 

Edit: well .. actually the code works just fine :D

It seems that I didn't understood it the first time. You need to run the script and then make a rightclick. It waits (WinWait) until the Class is existent (Context Menu) and then greys the item out. But it just works until the script is terminated.

Problem now is, that I just want to run this command once and them terminate the script. Do you think this is possible?

Edited by Leo1906
Link to comment
Share on other sites

3 minutes ago, pluto41 said:

You're right. It deactivates the item instead of deleting it. And a registry key for a Grey-out Option would be really nice.

But unfortunately this is as well not what I'm trying to archieve. Setting the  LegacyDisable Key will hide the Entry in the Menu, instead of disabling it. It looks the same as if the key would have been deleted .. :/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...