Пример #1
0
BOOL DestroyMenuData(HMENU hMenu, BOOL destroyMenu)
{
   INT i;
   for (i = 0; i < GetMenuItemCount(hMenu); i++)
   {
      MENUITEMINFO menuInf;
      ZeroMemory(&menuInf, sizeof(menuInf));
      menuInf.cbSize = sizeof(menuInf);
      menuInf.fMask = MIIM_DATA | MIIM_SUBMENU;
      if (GetMenuItemInfo(hMenu, i, TRUE, &menuInf))
      {
         pItemData pData = (pItemData)menuInf.dwItemData;
         DestroyIcon(pData->largeIcon);
         DestroyIcon(pData->smallIcon);
         if (pData->extra)
            delete pData->extra;
         delete pData;
      }
      if (menuInf.hSubMenu)
         DestroyMenuData(menuInf.hSubMenu);
   }
   if (destroyMenu)
	   DestroyMenu(hMenu);
   return TRUE;
}
Пример #2
0
CMenuBar::~CMenuBar()
{
	DestroyMenuData(m_hmenu,0);
}