CToolTipCtrl with TTF_TRACK Flag won't disappear, SetDelayTime doesn't work?
-
I found if set TTF_TRACK flag to CTooltipCtrl, SetDelayTime doesn't work anymore, so the tooltip won't disappear automatically. I want to show the tooltip just below specified control, and expect it to disappear after a few seconds(the time can set with SetDelayTime). Anybody can help me? Here is my steps to construct tool tip:1. Add member variable CToolTipCtrl m_tooltip; 2. override PreTranslateMessage BOOL CPF_GetSetNameDlg::PreTranslateMessage( MSG* pMsg ) { switch (pMsg->message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: case WM_MOUSEMOVE: m_tooltip.RelayEvent(pMsg); break; } return CDialog::PreTranslateMessage(pMsg); } 3. OnInitialDialog BOOL CPF_GetSetNameDlg::OnInitDialog() { CDialog::OnInitDialog(); //tooltip EnableToolTips(); m_tooltip.Create(this , WS_POPUP | TTS_NOPREFIX | TTS_BALLOON); m_tooltip.SetDelayTime(TTDT_INITIAL, 0); m_tooltip.SetDelayTime(TTDT_AUTOPOP, 30000); m_tooltip.SetDelayTime(TTDT_RESHOW, 30000); m_tooltip.AddTool(GetDlgItem(IDC_SETNAME), _T("")); m_tooltip.SetMaxTipWidth(600); } 4. Control to show tool tip if(bShow) { m_tooltip.UpdateTipText(_T("Hello, money!"), pWnd); CToolInfo sTinfo; m_tooltip.GetToolInfo(sTinfo, pWnd); sTinfo.uFlags = TTF_TRACK; m_tooltip.SetToolInfo(&sTinfo); CRect rect; pWnd->GetWindowRect(rect); m_tooltip.SendMessage(TTM_TRACKPOSITION, 0, (LPARAM)MAKELONG(rect.left, rect.bottom)); m_tooltip.SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&sTinfo ); }