+ // we must use ids in unsigned short range with Windows functions, if we
+ // pass ids > USHRT_MAX to them they get very confused (e.g. start
+ // generating WM_COMMAND messages with negative high word of wParam), so
+ // use the cast to ensure the id is in range
+ return m_subMenu ? wxPtrToUInt(m_subMenu->GetHMenu())
+ : wx_static_cast(unsigned short, GetId());