Вопрос

I have a menu that looks somewhat like the following,

enter image description here

When I open a particular dialog, I want to disable the whole menu. I realize that I can individually disable each menu item by using Update_Command_UIs, but that would mean adding event handlers for a 100 or more menu items. The menu is loaded initially with CMultiDocTemplate. Is there a way to do it by using the ID resource (IDR_MENU)?

Any help would be appreciated. Thank you.

Это было полезно?

Решение 2

I used ,

CMenu* pMenu = AfxGetMainWnd()->GetMenu();
if(pMenu != NULL)
{
    for(UINT i = 0; i < pMenu->GetMenuItemCount (); ++i)
        pMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED);
}

as mentioned in http://forums.codeguru.com/showthread.php?456136-Can-I-disable-menu-bar. It worked for me.

Другие советы

In your mainframe class, m_wndMenuBar.EnableWindow(FALSE);? The main menu items won't be grayed out, but they're not selectable.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top