void CMyView::OnInitialUpdate()
{
   CView::OnInitialUpdate();
   m_ToolTip.Create(this,TTS_ALWAYSTIP);
   m_ToolTip.AddTool(this,"sth");
   m_ToolTip.AddTool(&m_btSet,"设置");
}BOOL CMyView::PreTranslateMessage(MSG* pMsg)
{
    m_ToolTip.RelayEvent(pMsg);
    return CView::PreTranslateMessage(pMsg);
}void CMyView::OnMouseMove(UINT nFlags, CPoint point)
{
    m_ToolTip.UpdateTipText("试1", this);//这个始终无效
    m_ToolTip.UpdateTipText("试2", &m_btSet);//这个有效
}另外使用
m_ToolTip.DelTool(this);
m_ToolTip.AddTool(this, "试1");
也无效除非只使用
m_ToolTip.AddTool(this, "试1");
只是不能老加吧。我的是单文档多视,另一个视也是几乎相同的代码却可以。不知为何??

解决方案 »

  1.   

    Knowledge Base  SuperTip Demonstrates Tool Tips in an MFC ApplicationPSS ID Number: 188317Article Last Modified on 4/23/2003
    --------------------------------------------------------------------------------
    The information in this article applies to:
    The Microsoft Foundation Classes (MFC)--------------------------------------------------------------------------------This article was previously published under Q188317
    SUMMARY
    The SuperTip sample demonstrates some common uses of tool tips in an MFC application: 
    Tool tip support for toolbars
    How to use EnableToolTips
    A CToolTipCtrl object in a view, creating tools for windows and rectangular regions 
    For each of these tasks, the SuperTip sample demonstrates the default MFC support for tool tips, as well as how to change tool-tip text at run time. 
    MORE INFORMATION
    The following files are available for download from the Microsoft Download Center:http://download.microsoft.com/download/vc50pro/Sample/11/WIN98/EN-US/SuperTip.exe
      

  2.   

    十分感谢!不过这个例子只是演示了在不同RECT显示不同tips,但我需要使用UpdateTipText,比如显示鼠标的坐标等。不如有谁知道在何种情况下UpdateTipText会无效??
      

  3.   

    经过反复测试,终于明白为何UpdateTipText会无效了!!!同时感谢jiangsheng(蒋晟.Net) 的回复。