Gets the starting and ending character positions (in TCHARs) of the current selection in an edit control. You can send this message to either an edit control or a rich edit control.
A pointer to a DWORD value that receives the starting position of the selection. This parameter can be NULL.
A pointer to a DWORD value that receives the position of the first unselected character after the end of the selection. This parameter can be NULL.
The return value is a zero-based value with the starting position of the selection in the LOWORD and the position of the first TCHAR after the last selected TCHAR in the HIWORD. If either of these values exceeds 65,535, the return value is –1.
It is better to use the values returned in wParam and lParam because they are full 32-bit values.
If there is no selection, the starting and ending values are both the position of the caret.
Rich edit controls: You can also use the EM_EXGETSEL message to retrieve the same information. EM_EXGETSEL also returns starting and ending character positions as 32-bit values.
Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls.
Minimum supported client
|Windows 2000 Professional [desktop apps only]|
Minimum supported server
|Windows 2000 Server [desktop apps only]|
Build date: 10/27/2012