Jump to content

Recommended Posts

Posted

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? :)

Posted (edited)
  On 7/13/2016 at 9:48 AM, Leo1906 said:

Any ideas on this one? :)

Expand  

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
Posted
  On 7/13/2016 at 10:14 AM, 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...

Expand  

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 ..

Posted
  On 7/13/2016 at 10:24 AM, AutoBert said:
GUICtrlSetState($idOfCtrl,$GUI_DISABLE)

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

Expand  

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?

Posted
  On 7/13/2016 at 10:30 AM, AutoBert said:

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

Expand  

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.

Posted (edited)
  On 7/13/2016 at 11:21 AM, 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:

Expand  

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
Posted
  On 7/13/2016 at 3:03 PM, pluto41 said:
Expand  

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 .. :/

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
×
×
  • Create New...