在一个窗口里加上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;
}
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;
}
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);
}这样弄可以
{
// 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里响应