CString str, text, ss; str.Format(_T("%d ,%d"),point.x,point.y);

m_tool.GetText(text, this); ss = _T("");
ss = str +text +L"\0";
m_tool.UpdateTipText( ss, this);//m_tool是CToolTipCtrl 的对象。
显示时ss就像静态变量一样, 不断增加, 什么原因, 如何解决。

解决方案 »

  1.   

    m_tool.GetText(text,   this); 
    ss   =   _T(""); 
    ss   =   str   +text   +L"\0"; 这样写就应该不断增加啊
      

  2.   

    说的不明确 试试用 ss.Empty()
      

  3.   

    ss   =   str   +text   +L"\0"; 
    后面再加一个 "\0" 干吗????
      

  4.   

    你想一想你用了UpdateTipText这时候tooltip的字符串已经改变了!~下次再取则是已改变的字符串
    CString   str, ss; 
    str.Format(_T("%d   ,%d"),point.x,point.y); static CString text;if (第一次调用)
      m_tool.GetText(text,   this); ss   =   _T(""); 
    ss   =   str   +text   +L"\0"; 
    m_tool.UpdateTipText(   ss,   this); 
      

  5.   

    原来问题在  m_tool.GetText(text,       this);  也就是text发生变化了, 跟CString没关系。
      

  6.   

    解决了, 谢谢各位。 static  int time = 0;  CString str,  ss;
    static CString text; str.Format(_T("%d ,%d"),point.x,point.y);

    if(!time)
    {
    m_tool.GetText(text, this);
    time++;
    } ss = str +text; m_tool.UpdateTipText( ss, this);