Article ID: 172276
Article Last Modified on 11/21/2006
170365 INFO: Visual Studio 97 Service Packs - What, Where, and Why
#include <WTYPES.H>
#include "..\src\afximpl.h"
int CSuperTipFormView::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
{
HWND hWndChild = NULL;
// find child window which hits the point
// (don't use WindowFromPoint, because it ignores disabled windows)
// see _AfxChildWindowFromPoint(m_hWnd, point);
::ClientToScreen(m_hWnd, &point);
HWND hChild = ::GetWindow(m_hWnd, GW_CHILD);
for (; hChild != NULL; hChild = ::GetWindow(hChild, GW_HWNDNEXT))
{
if (_AfxGetDlgCtrlID(hChild) != (WORD)-1 &&
(::GetWindowLong(hChild, GWL_STYLE) & WS_VISIBLE))
{
// see if point hits the child window
CRect rect;
::GetWindowRect(hChild, rect);
if (rect.PtInRect(point))
{
hWndChild = hChild;
break;
}
}
}
if (hWndChild != NULL)
{
// return positive hit if control ID isn't -1
int nHit = _AfxGetDlgCtrlID(hWndChild);
// hits against child windows always center the tip
if (pTI != NULL && pTI->cbSize >= sizeof(AfxOldTOOLINFO))
{
// setup the TOOLINFO structure
pTI->hwnd = m_hWnd;
pTI->uId = (UINT)hWndChild;
pTI->uFlags |= TTF_IDISHWND;
pTI->lpszText = LPSTR_TEXTCALLBACK;
// set TTF_NOTBUTTON and TTF_CENTERTIP if it isn't a button
if (!(::SendMessage(hWndChild, WM_GETDLGCODE, 0, 0) &
DLGC_BUTTON))
pTI->uFlags |= TTF_NOTBUTTON|TTF_CENTERTIP;
}
return nHit;
}
return -1; // not found
}
167650 FIX: Problems with ToolTips on Windows 95
Keywords: kbbug kbfix kbnoupdate kbtooltip kbuidesign kbvs97sp3fix KB172276