Various methods to get entire text in a rich edit control as a CString

1.7k views Asked by At

I want to get the entire text in a rich edit control as a CString, and from my reaseach there appear to be six ways of achieving this:

  1. GetTextRange and get the range by using GetTextLength
  2. EM_GETTEXTEX
  3. GetWindowText
  4. GetDlgItemText
  5. WM_GETETXT
  6. EM_STREAMOUT

My questions are as follows:

  1. What is the difference between using methods such as GetTextRange, GetWindowText, and GetDlgItemText versus using messages such as EM_GETTEXTEX, WM_GETETXT, and EM_STREAMOUT.
  2. When would you use one type, and when would you use another?
  3. What is the difference between EM_GETTEXTEX, WM_GETETXT, and EM_STREAMOUT in terms of accomplishing this task of getting the entire text in a rich edit control as a CString?
  4. Finally would it be possible for someone to provide an example of how to use EM_GETTEXTEX, or point me in the direction of one online?
1

There are 1 answers

3
xMRi On

All are the same, except EM_STREAMOUT.

No. 1 to 5 just get the plain text. No. 6 gets the complete RTF stream. So No. 1. to 5. are just methods that do nearly the same as sending WM_GETTEXT.