一个基于对话框的程序
主对话框上面有列表控件 按钮 编辑控件
对它们都设置了Tooltip,
在OnInitDialog和OnMouseMove中设置和更新Tooltip。一开始启动程序后,
Tooltip显示都正常,
当一个子对话框domodal 运行一段时间 
子对话框再关闭,回到主对话框时,
有时 所有的Tooltip 不能显示,
请问这是怎么回事?

解决方案 »

  1.   

    是在PreTranslateMessage里加
    {
    // Let the ToolTip process this message.
    m_tooltip.RelayEvent(pMsg);}
      

  2.   

    我的程序一直就加了RelayEvent(pMsg)
    但是按照xuxingok兄的思路,在PreTranslateMessage中找问题,还是把问题解决了原来的程序
    BOOL CAccordCDRipperDlg::PreTranslateMessage(MSG* pMsg) 
    {   
    if(pMsg->message==WM_KEYDOWN   &&   (pMsg->wParam==VK_ESCAPE || pMsg->wParam==VK_RETURN) )
              return TRUE; if(m_ptoolTip1 != NULL)
           m_ptoolTip1->RelayEvent(pMsg);
    if(m_ptoolTip2 != NULL)
           m_ptoolTip2->RelayEvent(pMsg);
    if(m_ptoolTip3 != NULL)
           m_ptoolTip3->RelayEvent(pMsg); return CDialog ::PreTranslateMessage(pMsg);
    }修改后
    BOOL CAccordCDRipperDlg::PreTranslateMessage(MSG* pMsg) 
    {
    if(m_ptoolTip1 != NULL)
           m_ptoolTip1->RelayEvent(pMsg);
    if(m_ptoolTip2 != NULL)
           m_ptoolTip2->RelayEvent(pMsg);
    if(m_ptoolTip3 != NULL)
           m_ptoolTip3->RelayEvent(pMsg);
      
    if(pMsg->message==WM_KEYDOWN   &&   (pMsg->wParam==VK_ESCAPE || pMsg->wParam==VK_RETURN) )
    return   true; return CDialog ::PreTranslateMessage(pMsg);
    }显然子对话框的弹出 关闭导致m_ptoolTip1->RelayEvent(pMsg);没有被执行。
    谢谢各位!