|
-
June 5th, 1999, 10:26 AM
#1
Making a menu item inactive
How can I with code make a menu Item inactive at any time????
Thanks
-
June 5th, 1999, 11:19 AM
#2
Re: Making a menu item inactive
When a menu is about to be displayed by your application, your mainframe class will receive a WM_INITMENUPOPUP message.
Override this function and you can then call EnableMenuItem(ID_OF_ITEM, MF_DISABLED) on the Cmenu* pointer given you. Note, I am quoting this from memory, so my details might not be exactly correct...
HTH
Roger Allen
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
-
June 5th, 1999, 11:26 AM
#3
Re: Making a menu item inactive
Here u go. Use the MF_GRAYED to disable, and the MF_ENABLED to enable it.
HMENU thisMenu = GetMenu(hwnd);
// This specifies the 3rd pop-up menu
HMENU thisSubMenu = GetSubMenu(thisMenu,2);
bool bReturn;
// IDM_MENUITEM is the menu item to disable
bReturn = EnableMenuItem(thisSubMenu, IDM_MENUITEM, MF_GRAYED);
Hope this helps.
Todd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|