wince开发菜单栏控制

初始化方法:

HINSTANCE g_hInst = ::AfxGetInstanceHandle();
hwndmenu  = ::CommandBar_Create(g_hInst, m_hWnd, 1);
::CommandBar_InsertMenubar(hwndmenu, g_hInst, IDR_MENU2, 0);
::CommandBar_Show(hwndmenu, TRUE);

需要控制时调用:

HMENU hCBMenu = NULL;
hCBMenu = ::CommandBar_GetMenu(hwndmenu, 0);
hMenu = ::GetSubMenu(hCBMenu, 0);
::EnableMenuItem(hMenu,ID_ZICAIDAN1,MF_GRAYED);
hMenu = ::GetSubMenu(hCBMenu, 1);
::EnableMenuItem(hMenu,ID_ZICAIDAN2,MF_ENABLED);
::EnableMenuItem(hMenu,ID_ZICAIDAN3,MF_ENABLED);

你可能感兴趣的:(WinCE)