Member from my header...
mainmenu_manager::ptr m_mm;
My source...
MainMenuManager::MainMenuManager(const GUID& guid)
{
m_mm = mainmenu_manager::get();
m_mm->instantiate(guid);
}
STDMETHODIMP MainMenuManager::BuildMenu(IMenuObj* obj, UINT32 base_id)
{
RETURN_HR_IF(E_POINTER, m_mm.is_empty());
HMENU menu;
RETURN_IF_FAILED(obj->get(arg_helper(&menu)));
m_mm->generate_menu_win32(menu, base_id, UINT_MAX, mainmenu_manager::flag_show_shortcuts);
return S_OK;
}
STDMETHODIMP MainMenuManager::ExecuteByID(UINT32 id, VARIANT_BOOL* out)
{
RETURN_HR_IF_NULL(E_POINTER, out);
RETURN_HR_IF(E_POINTER, m_mm.is_empty());
*out = to_variant_bool(m_mm->execute_command(id));
return S_OK;
}
This code has seemingly worked for years and I'm using increments of 1000 for each base_id given I create 6 instances of this class for File, Edit, View etc. I've seen other code use UINT_MAX for the count.
But now I'm getting reports of totally wrong menu items from windows like this..
and WinRAR showing up here?
I can't reproduce myself but I have 2 different people reporting it.
I'm very confused.
edit: it seems incrementing the base_id by 10000 might fix it but when I posted a bit of code that walks every available menu item (including dynamic ones). I was getting numbers in the hundreds for all combined. Still confused.