BCGControlBar Pro for MFC
UINT BCGM_ON_BEFORE_SHOW_RIBBON_ITEM_MENU

Sent to Ribbon's parent before popup menu has been displayed.

Parameters
wParamThis parameter is not used.
lParamA pointer to CBCGPBaseRibbonElement.
Returns
The return value is ignored.

The framework sends BCGM_ON_BEFORE_SHOW_RIBBON_ITEM_MENU registered message to the Ribbon's parent before popup menu has been displayed.

You can process this message and modify popup menus on the fly.