Jump to content
Tuts 4 You
Sign in to follow this  
despy

disable c# MenuItem

Recommended Posts

despy

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?

Share this post


Link to post
Kurapica

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

Share this post


Link to post
despy
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.

Share this post


Link to post

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
Sign in to follow this  
×
×
  • Create New...