Forgive my ignorance, I'm fairly new to both OOM and COM connection points,
but how do I "assign a CommandBarButton object to those Id's"? Is this a VB
way of doing things - I'm working on a C++ addin.
Note that I have, since my initial posting, managed to trap clicks on the
actual Next and Previous controls (of type msoControlSplitButtonPopup) in
the command bar, but only by subclassing the command bar and hit testing.
This works but strikes me as somewhat crude. So the rest of this posting is
for my education.
The way the code I inherited works (and therefore the way I have learnt to
trap OOM events) is to obtain a pointer to the control (possibly using
FindControl) and then call DispEventAdvise on that pointer.
Therefore, my route into this particular problem was to loop through all the
controls on the Standard toolbar, logging their caption, type and ID. From
this I saw that the Next and Previous controls were of type
msoControlSplitButtonPopup (with the IDs you specified) - if I look at
either the help file or my type library headers, I can see no events
associated with this type of control, and no way to get at the buttons they
appear to contain.
When I loop through the controls owned by these msoControlSplitButtonPopups,
then I can see CommandBarButtons with IDs 359 and 360 (and 6 x 2 others) -
however, sinking events from these traps clicks on the first (&Item) items
in the popup menus (which I think is what you say you don't know how to do),
rather than the button on the command bar - sample code snippet:
CommandBarPopupPtr spPopup
= m_spCommandBar->FindControl((long)msoControlSplitButtonPopup, 360L);
if (spPopup)
{
m_spNextPopupItem1 = spPopup->Controls->Item[1L];
NextPopupItem1EventsImpl:
ispEventAdvise(m_spNextPopupItem1);
}
Any help in diverting me from the evil ways of subclassing to the true path
of OOM appreciated!
Thanks
Matt Fletcher