Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CEdit::GetSel

CEdit::GetSel 

Call this function to get the starting and ending character positions of the current selection (if any) in an edit control, using either the return value or the parameters.


DWORD GetSel( ) const;
void GetSel(
   int& nStartChar,
   int& nEndChar 
) const;

Parameters

nStartChar

Reference to an integer that will receive the position of the first character in the current selection.

nEndChar

Reference to an integer that will receive the position of the first nonselected character past the end of the current selection.

The version that returns a DWORD returns a value that contains the starting position in the low-order word and the position of the first nonselected character after the end of the selection in the high-order word.

For more information, see EM_GETSEL in the Platform SDK.

// The pointer to my edit.
extern CEdit* pmyEdit;

// Set the selection to be all characters after the current selection.
DWORD dwSel = pmyEdit->GetSel();
pmyEdit->SetSel(HIWORD(dwSel), -1);

Community Additions

ADD
Show:
© 2015 Microsoft