简体   繁体   English

获得丰富的编辑控件中的整个文本作为CString的各种方法

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

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: 我想在一个丰富的编辑控件中将整个文本作为CString来获取,从我的研究中,似乎有六种方法可以实现这一点:

  1. GetTextRange and get the range by using GetTextLength GetTextRange并通过使用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 E M_STREAMOUT . 使用诸如GetTextRangeGetWindowTextGetDlgItemText与使用诸如EM_GETTEXTEXWM_GETETXT和E M_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 ? EM_GETTEXTEXWM_GETETXTEM_STREAMOUT在完成此任务方面有什么区别,该任务是在丰富的编辑控件中以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? 最终,有人可以提供一个使用EM_GETTEXTEX ,还是让我朝着一个在线的方向发展?

All are the same, except EM_STREAMOUT. 除EM_STREAMOUT以外,其他都相同。

No. 1 to 5 just get the plain text. 1至5号只是纯文本。 No. 6 gets the complete RTF stream. 6号获得完整的RTF流。 So No. 1. to 5. are just methods that do nearly the same as sending WM_GETTEXT. 因此,第1至5号方法与发送WM_GETTEXT的方法几乎相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM