在一个窗口里加上tooltip控件,鼠标移到此窗口上有tooltip提示,当鼠标停几秒钟后,tooltip消失,这正常,但是tooltip消失后就不管鼠标怎么移动就再也出不来了,这是什么原因?
m_tooltip.Create(m_hWnd);
m_tooltip.ModifyStyle(0, TTS_ALWAYSTIP);
CToolInfo  ti(TTF_IDISHWND, m_hWnd, (UINT)m_hWnd, NULL, TEXT("Good tooltip."));
m_tooltip.AddTool(&ti);
m_tooltip.Activate(TRUE);
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LPMSG lpMsg = (LPMSG)GetCurrentMessage();
m_tooltip.RelayEvent(lpMsg);
return 0;
}

解决方案 »

  1.   


            EnableToolTips(TRUE); m_tooltip.Activate(TRUE);

    m_tooltip.AddTool(AfxGetMainWnd(),"这是一个按钮");

    m_tooltip.SetDelayTime(150);    //出现提示前的延迟时间,非必需BOOL CXXDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    m_tooltip.RelayEvent(pMsg);
    return CDialog::PreTranslateMessage(pMsg);
    }这样弄可以
      

  2.   

    m_tooltip.RelayEvent(lpMsg); 应该放在PreTranslateMessage中
      

  3.   

    我这个程序是用wtl做的,相当于用API的方式做的,如何解决tooltip消失后就不出来的问题
      

  4.   

    void CXXDlg::OnMouseMove(UINT nFlags, CPoint point) 
    {
    // TODO: Add your message handler code here and/or call default
    MSG pMsg;
    pMsg.hwnd = m_hWnd;
    pMsg.message = WM_MOUSEMOVE;;
    m_tt.RelayEvent(&pMsg);
    CDialog::OnMouseMove(nFlags, point);
    }要WM_MOUSEMOVE里响应