Tooltip not showing on some XP computers.
I have an MFC dlg app. A list control on it with two items.
When moving on items, my tooltip shows. In most XP computers it does work
except few! When I do not embed a manifest for common controls.
and do not provide manifest. It uses system32 dir version, all works fine
(with classic syles showing).
But if manifest is provided or embeded, it uses the WinSxS version of common
controls, but some computers, tooltips arenot showing. All cases
OnToolHitTest is visited, because I have a Beep there, and hear it.
So I can not see a difference in dll file and product infos also!!!
What is the problem. My code is Basic wizard MFC Dialog with one
OnToolHitTest override as below.
Many thanks.
Has
BOOL CToolTipXDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_list.InsertColumn(0, _T("Test List"));
CRect rc;
m_list.GetWindowRect(&rc);
m_list.SetColumnWidth(0, rc.Width());
m_list.InsertItem(0,_T("Item One"));
m_list.InsertItem(1,_T("Item Two"));
EnableToolTips(TRUE);
.....
return TRUE; // return TRUE unless you set the focus to a control
}
INT_PTR CToolTipXDlg::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
{
// TODO: Add your specialized code here and/or call the base class
UINT uFlags;
CPoint pt2 = point;
MapWindowPoints(CWnd::FromHandle(m_list), &pt2, 1);
int nItem = m_list.HitTest(pt2, &uFlags);
if (nItem >= 0) {
Beep(3000,20);
pTI->hwnd = m_hWnd;
pTI->uId = UINT(m_list.m_hWnd);
pTI->uFlags |= TTF_NOTBUTTON | TTF_IDISHWND;
CToolTipCtrl* pToolTip = AfxGetModuleThreadState()->m_pToolTip;
assert(pToolTip != NULL);
pToolTip->ModifyStyle(0, TTS_BALLOON);
CRect rect;
GetClientRect(&rect);
pToolTip->SendMessage(TTM_SETMAXTIPWIDTH, 0, rect.right - rect.left);
pToolTip->SendMessage(TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELONG(0x7fff, 0));
pToolTip->SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, MAKELONG(100, 0));
CString strText(_T("Testing tooltip"));
pTI->lpszText = _tcsdup(strText);
pTI->hinst = NULL;
return MAKELONG(point.x, point.y);
}
return CDialog::OnToolHitTest(point, pTI);
}