I want to add a butoon to the window explorer's toolbar to allow users to
navigate directly to my NSE. I have implemented a BHO and try to add the
button on the SetSite but without success.
On the SetSite I get a pointer to IShellBrowser, SetToolbarItems returns
S_OK but no button is created!!
Anyone know how to do it?
Thanks,
Franki.
TBADDBITMAP tbadbm;
int iButtonIndex;
int iStringIndex;
TBBUTTON tbb;
TCHAR szLabel[MAX_PATH];
lstrcpy(szLabel, _T("test"));
tbadbm.hInst = _AtlBaseModule.GetResourceInstance(); // The module's
instance handle
tbadbm.nID = IDB_BITMAP; // The bitmap's resource ID
LRESULT lRet;
m_pSB->SendControlMsg(FCW_TOOLBAR, TB_ADDBITMAP,
1,reinterpret_cast<LPARAM>(&tbadbm), &lRet);
iButtonIndex = lRet;
m_pSB->SendControlMsg(FCW_TOOLBAR, TB_ADDSTRING,
NULL,reinterpret_cast<LPARAM>(szLabel), &lRet);
iStringIndex = lRet;
ZeroMemory(&tbb, sizeof(TBBUTTON));
tbb.iBitmap = iButtonIndex;
tbb.idCommand = FCIDM_SHVIEWFIRST + 1;
tbb.iString = iStringIndex;
tbb.fsState = TBSTATE_ENABLED;
tbb.fsStyle = TBSTYLE_BUTTON;
HRESULT hr = m_pSB->SetToolbarItems(&tbb, 1, FCT_MERGE);