我的代码是这样的```LRESULT CMFToolbar::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
  //使按钮可以支持文本与图片
  //SendMessage(m_hWnd,   TB_SETEXTENDEDSTYLE,   0,   (LPARAM)TBSTYLE_EX_DRAWDDARROWS);
  //设置按钮的大小
  SendMessage(m_hWnd,   TB_BUTTONSTRUCTSIZE,   sizeof(TBBUTTON),   0);   
  //设置文本框的文本最大长度
  SendMessage(m_hWnd,   TB_SETMAXTEXTROWS,   1,   0L);   
    
  //添加按钮的标题
  TCHAR*   pCaption   =   _T("MEUU");   
  int   iIndex   =   ::SendMessage(m_hWnd,   TB_ADDSTRING,   0,(LPARAM)pCaption);   
  pCaption=_T("网站");   
  iIndex   =::SendMessage(m_hWnd,TB_ADDSTRING,0,(LPARAM)pCaption);   
  pCaption=_T("软件");   
  iIndex   =::SendMessage(m_hWnd,TB_ADDSTRING,0,(LPARAM)pCaption);   
  pCaption=_T("管理");   
  iIndex   =::SendMessage(m_hWnd,   TB_ADDSTRING,   0,(LPARAM)pCaption);     //加载按钮的图标与创建图片列表
  HICON   hMotley   =   LoadIcon(_Module.GetResourceInstance(),   MAKEINTRESOURCE(IDI_MOTLEY));   
  m_hImageList   =   ImageList_Create(16,16,   ILC_COLOR16,   1,   0);   
  int   iImageIndex   =   ImageList_AddIcon(m_hImageList,   hMotley);   
  DestroyIcon(hMotley);   
  hMotley   =   LoadIcon(_Module.GetResourceInstance(),   MAKEINTRESOURCE(IDI_MOTLEY));   
  iImageIndex   =   ImageList_AddIcon(m_hImageList,   hMotley);   
  DestroyIcon(hMotley);  //设置工具条的图片
  ::SendMessage(m_hWnd,   TB_SETIMAGELIST,   0,   (LPARAM)m_hImageList);  TBBUTTON Buttons[3];
  ZeroMemory(Buttons,sizeof(Buttons));  
  Buttons[0].iString=1;
  Buttons[0].fsState=TBSTATE_ENABLED;
  Buttons[0].fsStyle=TBSTYLE_BUTTON;
  Buttons[0].iBitmap=0;
  Buttons[0].dwData=0L;
  Buttons[0].idCommand=IDM_GETQUOTE;  //Buttons[1].iString=2;
  Buttons[1].fsState=TBSTATE_ENABLED;
  Buttons[1].fsStyle=TBSTYLE_SEP;
  //Buttons[1].iBitmap=0;
  Buttons[1].dwData=0L;
  //Buttons[1].idCommand=IDM_FRIENDS;  Buttons[2].iString=3;
  Buttons[2].fsState=TBSTATE_ENABLED;
  Buttons[2].fsStyle=TBSTYLE_BUTTON;
  Buttons[2].iBitmap=0;
  Buttons[2].dwData=0L;
  Buttons[2].idCommand=IDM_ACTIVITY;
  ::SendMessage(m_hWnd,TB_ADDBUTTONS,sizeof(Buttons)/sizeof(TBBUTTON),(LPARAM)&Buttons);
  RECT   rect   =   {0,0,0,0};   
  m_EditWnd.Create(m_hWnd,   rect,   NULL,   WS_CHILD|WS_VISIBLE,   WS_EX_CLIENTEDGE);   
  m_EditWnd.SetFont(static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT)));   
  return   0;   
  }

解决方案 »

  1.   

    ::SendMessage(m_hWnd,TB_ADDBUTTONS,sizeof(Buttons)/sizeof(TBBUTTON),(LPARAM)&Buttons[0]);
    ::SendMessage(m_hWnd,TB_ADDBUTTONS,sizeof(Buttons)/sizeof(TBBUTTON),(LPARAM)&Buttons[1]);
      

  2.   

    If the toolbar was created using the CreateWindowEx function, you must send the TB_BUTTONSTRUCTSIZE message to the toolbar before sending TB_ADDBUTTONS.
      

  3.   

    你的是正确的
    可能是m_EditWnd把其他的遮住了吧!~
      

  4.   

    他上面已经发了TB_BUTTONSTRUCTSIZE消息
      

  5.   

    最上面调用:
    SendMessage(m_hWnd, CCM_SETVERSION, (WPARAM) 5, 0);