Apparently the indices provided in NMTBGETINFOTIP (TBN_GETINFOTIP data struct), are not reliable,
but since the lParam values are, and it saves us a lookup, we will be using those instead. Win-Win!
- VOID GetTooltipText(int index, LPTSTR szTip, DWORD cchTip)
+ VOID GetTooltipText(LPARAM data, LPTSTR szTip, DWORD cchTip)
- InternalIconData * notifyItem = GetItemData(index);
-
+ InternalIconData * notifyItem = reinterpret_cast<InternalIconData *>(data);
if (notifyItem)
{
StringCchCopy(szTip, cchTip, notifyItem->szTip);
}
if (notifyItem)
{
StringCchCopy(szTip, cchTip, notifyItem->szTip);
}
+ else
+ {
+ StringCchCopy(szTip, cchTip, L"");
+ }
LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled)
{
NMTBGETINFOTIPW * nmtip = (NMTBGETINFOTIPW *) hdr;
LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled)
{
NMTBGETINFOTIPW * nmtip = (NMTBGETINFOTIPW *) hdr;
- Toolbar.GetTooltipText(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax);
+ Toolbar.GetTooltipText(nmtip->lParam, nmtip->pszText, nmtip->cchTextMax);