I have a custom command:
class ATL_NO_VTABLE CSliceSelector :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CSliceSelector, &CLSID_SliceSelector>,
public ISliceSelector,
public ICommand,
public IComboBox
{
...
}
I also have a custom Toolbar where I try to add my custom command:
class ATL_NO_VTABLE CSeismicToolbar :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CSeismicToolbar, &CLSID_SeismicToolbar>,
public ISeismicToolbar,
public IToolBarDef
{
...
STDMETHOD(GetItemInfo)(long pos, IItemDef * itemDef) {
if (itemDef == NULL)
return E_POINTER;
if (pos == 0) { // CSliceSelector
itemDef->put_Group (VARIANT_FALSE);
HRESULT hr = itemDef->put_ID(CComBSTR(L"{96A2B223-BF0D-410C-B22B-892FED3D9A15}"));
if (FAILED (hr)) {
return hr;
}
}
}
}
However when I start ArcScene; I see a red circle icon and the text "Missing" (see the attached image), instead of my command :-(.However if I add it manually from Customize toolbars; it works fine.I have tried both returning a null pointer and a valid bitmap:
CSliceSelector()
{
m_hBitmap = ::LoadBitmap(_AtlBaseModule.GetModuleInstance(),MAKEINTRESOURCE(IDB_SLICE));
}
STDMETHODIMP CSliceSelector::get_Bitmap(OLE_HANDLE * Bitmap)
{
if (Bitmap == NULL)
return E_POINTER;
*Bitmap = (OLE_HANDLE) m_hBitmap;
return S_OK;
}
I have other commands that are not combobox; and they work fine.