I know that there is at least one other forum item about this subject, but
I didn't see an answer.

I'm using C++ to do some customisation and my C3PO currently
(successfully!) adds a menu item, and now I want to add (just one at the
moment) a toolbar item. My code is getting called fine, however the Add
method doesn't appear to work even though I get a good return code (and a
dispatch pointer for the new button). Toolbaritems.count returns the same
value before and after the add method. What am I doing wrong. (ps I'm
using GW 7). code snippet follows:

BSTR bstrCaption = SysAllocString(pszCaption);
BSTR bstrIconResourceFile;
VARIANT vtTemp; VariantInit(&vtTemp);

long lItemCount;

pToolbarItems->get_Count(&lItemCount); // returns 14

// Create the new Command handler
pCmd = new CGWCommand(ButtonID);
pCmd->QueryInterface(IID_IDispatch, (void**)&lpdCommand);

hr = pToolbarItems->Add(bstrCaption, lpdCommand, vtTemp, &lpdButton);
if (SUCCEEDED(hr))
pToolbarItems->get_Count(&lItemCount); // STILL returns 14
// setup to add the Icon to the button
lpdButton->QueryInterface(IID_IGWToolbarItem, (void**)&pButton);

bstrIconResourceFile = SysAllocString(ICON_RESOURCE);
vtTemp.vt = VT_I4;
vtTemp.lVal = (long)IconID;
hr = pButton->SetBitmap(bstrIconResourceFile, vtTemp);



// Add the tooltip (to the command handler)
pCmd->bstrToolTip = ::SysAllocString(pszTooltip);