CMenu menu = GetMenu(hWnd); // hWnd is the handle to the window containing the menu UINT state = menu.GetMenuState(ID_MENU_ITEM, MF_BYCOMMAND); if (state & MF_ENABLED) { // Menu item is enabled }
CMenu menu = GetMenu(hWnd); UINT state = menu.GetMenuState(ID_MENU_ITEM, MF_BYCOMMAND); if (state & MF_CHECKED) { // Menu item is checked }This example is similar to Example 1, but it checks for the `MF_CHECKED` flag instead to determine whether the menu item is checked. Package library: MFC (Microsoft Foundation Class Library)