CTreeCtrl::HitTest
HTREEITEMHitTest(CPointpt**,UINT*pFlags);**
HTREEITEMHitTest(TVHITTESTINFO*pHitTestInfo);
Return Value
The handle of the tree view item that occupies the specified point or NULL if no item occupies the point.
Parameters
pt
Client coordinates of the point to test.
pFlags
Pointer to an integer that receives information about the results of the hit test. It can be one or more of the values listed under the flags member in the Remarks section.
pHitTestInfo
Address of a structure that contains the position to hit test and that receives information about the results of the hit test.
Remarks
Call this function to determine the location of the specified point relative to the client area of a tree view control.
When this function is called, the pt parameter specifies the coordinates of the point to test. The function returns the handle of the item at the specified point or NULL if no item occupies the point. In addition, the pFlags parameter contains a value that indicates the location of the specified point.
Example
// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
// The point to test.
extern CPoint myPoint;
// Select the item that is at the point myPoint.
UINT uFlags;
HTREEITEM hItem = pmyTreeCtrl->HitTest(myPoint, &uFlags);
if ((hItem != NULL) && (TVHT_ONITEM & uFlags))
{
pmyTreeCtrl->Select(hItem, TVGN_CARET);
}
CTreeCtrl Overview | Class Members | Hierarchy Chart
See Also CTreeCtrl::GetItemRect