EM_CHARFROMPOS

This message is sent by an application to retrieve the zero-based character index and zero-based line index of the character nearest the specified point in an edit control.

At a Glance

Header file: Winuser.h
Windows CE Versions: 1.0 and later

Syntax

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

Parameters

lParam

Specifies the coordinates of a point in the control’s client area. The coordinates are in screen units and are relative to the upper-left corner of the control’s client area.

Control Description
Rich edit controls lParam is a pointer to a POINTL structure that contains the horizontal and vertical coordinates.
Edit controls 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.

See Also

EM_POSFROMCHAR