EM_CHARFROMPOS

This message retrieves the zero-based character index and zero-based line index of the character nearest the specified point in an edit control.

EM_CHARFROMPOS 
  wParam = 0; 
  lParam = MAKELPARAM(x, y);

Parameters

  • wParam
    Not used; set to 0.
  • lParam
    Specifies the coordinates of a point in the client area of the control. The coordinates are in screen units and are relative to the upper-left corner of the client area of the control. The low-order word of lParam contains the horizontal coordinate. The high-order word contains the vertical coordinate.

Return Values

The low-order word of the return value specifies the zero-based index of the character nearest the specified point. This index is relative to the beginning of the control, not the beginning of the line. If the specified point is beyond the last character in the edit control, the return value indicates the last character in the control.

The high-order word of the return value specifies the zero-based index of the line that contains the character. For single-line edit controls, this value is zero. The index indicates the line delimiter if the specified point is beyond the last visible character in a line.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Windows.h.

See Also

EM_POSFROMCHAR | Edit Box Messages

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.