First of all, you need to allocate a new command in the command manager before using it in the toolbar button:
UINT nCmdID = 10000; // if zero, then free ID will be found automatically
CExtCmdItem * pCmdItem =
g_CmdManager->CmdAllocPtr
"your command profile name",
nCmdID
);
Now you have a valid registered command which has no icon nor text for menu/toolbar/tooltip/status tip assigned. We will assign only text for a toolbar here:
pCmdItem->m_sToolbarText = _T("text");
You can also assign tooltip:
pCmdItem->m_sTipTool = _T("tip text");
Now you can insert the button into a toolbar:
m_wndToolBar.InsertButton(
nPos, // if -1, then append to end
nCmdID
)