I want to control my toolbar dynamically.

First I added tool bar with style including TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_LIST.
Then added the tool bar to a rebar. I added tool tips by handling TTN_GETDISPINFO.

Everything works fine. But when I try to add text to right of the button, the text
gets added but button size is not automatically changing.

The following code is not working .

void SetToolbarText(HWND& hwndToolbar,LPTSTR szText)
{
ATLASSERT(::IsWindow(hwndToolbar));
TBBUTTONINFO tbbi = { 0 };
tbbi.cbSize = sizeof(TBBUTTONINFO);
tbbi.dwMask = TBIF_TEXT;// | TBIF_SIZE;//if I add TBIF_SIZE code will work!
tbbi.cchText = 0;
tbbi.cx = 200;
tbbi.fsState = 0;
tbbi.fsStyle = tbbi.fsStyle | BTNS_SHOWTEXT | BTNS_AUTOSIZE ;//TBSTYLE_AUTOSIZE
//tbbi.fsStyle = tbbi.fsStyle | BTNS_SHOWTEXT | TBSTYLE_AUTOSIZE ;//TBSTYLE_AUTOSIZE
tbbi.idCommand = 0;
tbbi.iImage = 0;
tbbi.lParam = 0;
tbbi.pszText = szText;//szText is _T("ABC")
BOOL b = (BOOL)::SendMessage(hwndToolbar, TB_SETBUTTONINFO, ID_BUTTON3, (LPARAM)&tbbi);
return;
}

Can anybody please help me?