The framework calls this member function to detemine whether a point is in the bounding rectangle of the specified tool.

virtual INT_PTR OnToolHitTest( 
   CPoint point, 
) const;


  • point
    Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window

  • pTI
    A pointer to a TOOLINFO structure. The following structure values are set by default:

    • hwnd = m_hWnd Handle to a window

    • uId = (UINT)hWndChild Handle to a child window

    • uFlags |= TTF_IDISHWND Handle of the tool

    • lpszText = LPSTR_TEXTCALLBACK Pointer to the string that is to be displayed in the specified window

Return Value

If the tooltip control was found, the window control ID. If the tooltip control was not found, -1.


If the point is in the rectangle, it retrieves information about the tool.

If the area with which the tooltip is associated is not a button, OnToolHitTest sets the structure flags to TTF_NOTBUTTON and TTF_CENTERTIP.

Override OnToolHitTest to provide different information than the default provides.

See TOOLINFO, in the Windows SDK, for more information about the structure.


Header: afxwin.h

See Also


CWnd Class

Hierarchy Chart