June 5th, 1999, 10:26 AM
How can I with code make a menu Item inactive at any time????
Thanks
Thanks
|
Click to See Complete Forum and Search --> : Making a menu item inactive June 5th, 1999, 10:26 AM How can I with code make a menu Item inactive at any time???? Thanks Roger Allen June 5th, 1999, 11:19 AM 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 Todd Casey June 5th, 1999, 11:26 AM 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 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |