Jump to content
Tuts 4 You

disable c# MenuItem


despy

Recommended Posts

Posted

an C# exe with no src code,now i want to disable some menuItems with APIs.

like this:

HMENU hMenu = (HMENU) PostMessage(hWnd, MN_GETHMENU, 0, 0);

EnableMenuItem(hMenu,uIdEnableMenultem,MF_DISABLED); ...

but it's not work for C# exe.What should I do?

Posted

If the application is using the standard WinFroms menus then your technique won't work !

Those menus are not the typical WIN32 menus that respond to these APIs so you will have use

Reflection, decompilation, or any other way to modify the property "Enabled" of that menu Item to FALSE.

  • Like 2
Posted
On 2017/6/1 at 10:02 PM, Kurapica said:

If the application is using the standard WinFroms menus then your technique won't work !

Those menus are not the typical WIN32 menus that respond to these APIs so you will have use

Reflection, decompilation, or any other way to modify the property "Enabled" of that menu Item to FALSE.

tks,i'll have a try to use reflection.

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