How to get text from rich edit control as a CStrin

2020-05-02 07:07发布

问题:

I want to get the entire text in a rich edit control as a CString something like GetDlgItemText but this is for dialog boxes. The closest thing i can find from my research is: GetTextRange and get the range by using GetTextLength....But I suspect there is a better way....

回答1:

  • GetWindowText.
  • GetDlgItemText works to, if you use the parent window and the ID of the RTF Control.
  • WM_GETETXT.

If you want to retrieve the complete RTF text you Need to use EM_STREAMOUT (enough samples in the net).