In CRichEditCtrl, how to get list of words in the selection.

abc abc 351 Reputation points
2020-09-18T05:57:58.727+00:00

Hi,

In CRichEditCtrl, how to get list of words in the selection.
For e.g. if the CRichEditctrl text is abc<def> bnm ser and selected text in the abc<def> b, the word list needs to contain abc,<def>, bnm

How to achieve this?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,717 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 45,396 Reputation points
    2020-09-19T12:23:53.9+00:00

    You can use CRichEditCtrl.FindWordBreak which uses the EM_FINDWORDBREAK message. However, if you want to treat angle brackets "<>" as delimiters you will need to write some code to accomplish this.

    Apparently you want to implement your own rules to parse the control's content. So the question is a bit unclear. It asks how to find words in a selection but expects the resulting word list to include words that are not fully included in the selection. If the selection begins in the middle of a word should that word also be included in the word list? Are opening and closing angle brackets required in order to receive delimiter treatment?

    For further information refer to How to Use Word and Line Break Information. Note that although you can instruct the rich edit control to use your own custom word break procedure this technique is not recommended by MS.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.