Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

The CExtToolControlBar class stores the HMENU attribute for every button. So, you can do this by invoking CExtToolControlBar::SetButtonMenu():

CExtCmdManager::cmd_t * p_cmd;
CMenu _menu;
p_cmd = g_CmdManager->CmdGetPtr(ID_CMD_...);
ASSERT( p_cmd != NULL );
VERIFY( _menu.LoadMenu(ID_MENU_...);
VERIFY(
    m_wndToolBarMain.SetButtonMenu(
      m_wndToolBarMain.CommandToIndex(ID_CMD_...),
      _menu.Detach(),
      TRUE
      )
    );