How to add separator to CToolBar?

i added some button in CtoolBar after separator.but it s not showing names for the buttons.
now i have separator before IDS_ENABLESCAN id which isTBBS_CHECKGROUP.but i was adding simple buttons after sepearator.with out separator its working fine..
      CDC* dc = m_mainToolBar.GetDC();
      CSize size;
      size = dc->GetTextExtent("Test"); +=;

      //setting the buttons to be radio style
      int i =0;

      while ( !(m_mainToolBar.GetButtonStyle(i) & TBBS_SEPARATOR) )




      //the following buttons is used to start/pause the network scanning

//Ramesh - TL_C1_4_FEA_09 - XC Support of IP DCN Mgmt - Start
//Ramesh - TL_C1_4_FEA_09 - XC Support of IP DCN Mgmt - End

      CSize tbSize; =; = 0;

      CRect butRect;
      for (i=0;i<m_mainToolBar.GetCount();i++)
            m_mainToolBar.GetItemRect(i, butRect);
   += butRect.Width();

      return tbSize;
static UINT toolbarTextIds[] =
//Ramesh - TL_C1_4_FEA_012 - Usability Enhancements - Start
    IDS_TOOLBAR_ERR ,        
so please to add sepatrator between buttons..

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi srikadi,

IMO the problem is the loop:
> while ( !(m_mainToolBar.GetButtonStyle(i) & TBBS_SEPARATOR) )

This will run until the first seperator-button is found, then it stops. I guess it should be something like this:

> for (i=0;i<m_mainToolBar.GetCount();i++)
> {
>   if( 0 != (m_mainToolBar.GetButtonStyle(i) & TBBS_SEPARATOR) )
>   {
>     // don't add text for seperator
>     continue;
>   }
>   m_mainToolBar.SetButtonStyle(i,TBBS_CHECKGROUP);
>   buttonText.LoadString(toolbarTextIds[index]);
>   m_mainToolBar.SetButtonText(i,buttonText);
>   index++;
> }

Hope that helps,



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
srikadiAuthor Commented:
wow..its worked perfectly..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.