BCGControlBar Pro for MFC
int CBCGPEditCtrl::HitTest ( CPoint &  pt,
BOOL  bNormalize = FALSE,
BOOL  bIgnoreTextBounds = FALSE 
)

Given a point in the client coordinates returns the offset of a symbol containing this point from the beginning of the text.

Returns
Offset from the beginning of the text. The number includes '\n' (end of line) symbols. The returned value will be -1 if bIgnoreTextBounds is FALSE and the point lays outside of the text area (m_rectText).

Call this member function if you want to determine the offset of a symbol containing the specified point in the client coordinates. If the point is outside of text the this function returns the offset of the nearest symbol.

If the function return the value different than -1 and bNormalize is TRUE, pt will contain coordinates of top-left corner of the symbol whose offset is returned.

Parameters
ptSpecifies the point to test.
bNormalizeIf TRUE, when the function returns pt will contain coordinates of the symbol whose offset is returned by the function.
bIgnoreTextBoundsIf FALSE, the function will fail (return -1) if the specified point is outside of the text bounding rectangle.