Link to home
Start Free TrialLog in
Avatar of wuttrain
wuttrain

asked on

Disabling a Menu item - Notepad for example

Hi Guys,

  How do I enable/disable a menu item using API?

  For example, I open Notepad application, run my program,
and then when I click the File menu (of Notepad), the New menu item is disabled.

  Is that possible?  
  Thanks!

wuttrain
Avatar of devoted2christ
devoted2christ

I think that would depend a lot on the program. Some programs control their menu by populating it from registry values, while others store the information internally (just create a VB6 app with a menu and you'll see what I'm talking about). If it's just one program you're trying to do this to, then it may be possible, but for the most part it's going to be a very difficult chore...
Avatar of wuttrain

ASKER

devoted2christ,

thanks for the comments.  but i think i got the code i needed.

  lHwnd = GetHWND("Point -*", "*", "Send Menu Command - Import")
  hMainMenu = GetMenu(lHwnd)
  hMenu = GetSubMenu(hMainMenu, 0) 'get into the File Menu 0
 
  lRet = ModifyMenu(hMainMenu, 6, MF_BYPOSITION Or MF_GRAYED, 2, "&Lenders")
Oh, ok cool; I didn't know that. You can post a question in Community Support to get your points refunded.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

leonstryker
EE Cleanup Volunteer
leonstryker,

  I would like to have a refund for this question.  What should I do?

  Thanks!
Please post to the Community Support area.

Leon
ASKER CERTIFIED SOLUTION
Avatar of SpazMODic
SpazMODic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial