Example #1
0
void CViewToolbar::UpdateTexts()
{
    CDocument *pDocument = g_app.GetDocument();
    TCHAR szText[MAX_CAPTION];
    TBBUTTONINFO tbbi;

    tbbi.cbSize = sizeof(tbbi);
    tbbi.dwMask = TBIF_TEXT;
    tbbi.pszText = szText;
    tbbi.cchText = MAX_CAPTION;
    for (int i = 0; i < MAX_CATEGORIES; i++)
    {
        if (pDocument->GetCount(i) != m_nCounts[i])
        {
            m_nCounts[i] = pDocument->GetCount(i);
            _stprintf_s(szText, MAX_CAPTION, m_szFormats[i], m_nCounts[i]);
            SendMessage(m_hWnd, TB_SETBUTTONINFO, ID_VIEW_ALL + i, (LPARAM)&tbbi);
        }
    }
}