An application sends the EM_POSFROMCHAR message to retrieve the coordinates of the specified character in an edit control.
EM_POSFROMCHAR wParam = (UINT) wCharIndex; // zero-based index of character lParam = 0; // reserved; must be zero
The return value indicates the coordinates of the upper-left corner of the specified character. The low-order word of the return value is the x-coordinate; the high-order word is the y-coordinate. The coordinates are relative to the upper-left corner of the edit control’s client area.
If wCharIndex is greater than the index of the last character in the control, the returned coordinates are of the position just past the last character of the control.
For a single-line edit control, the y-coordinate is always zero. A returned coordinate can be negative if the character has been scrolled outside the edit control’s client area. The coordinates are truncated to integer values.
If wCharIndex is the index of a line delimiter, the returned coordinates are of the position just past the last visible character in the line.