Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize


Retrieves the text from the current selection in this CRichEditCtrl object.

long GetSelText( 
   LPSTR lpBuf  
) const; 
CString GetSelText( ) const;


Pointer to the buffer to receive the text in the current selection.

Depends on the form:

  • GetSelText( lpBuf )   The number of characters copied into lpBuf, not including the null termination.

  • GetSelText( )   The string containing the current selection.

If you use the first form, GetSelText( lpBuf ), you must ensure that the buffer is large enough for the text it will receive. Call GetSel to determine the number of characters in the current selection.

For more information, see EM_GETSELTEXT in the Windows SDK.

Header: afxcmn.h

© 2015 Microsoft