Finds Unicode text within a rich edit control.



Specifies the behavior of the search operation. This parameter can be one or more of the following values.

Value Meaning
Microsoft Rich Edit 2.0 and later: If set, the search is forward from FINDTEXTEX.chrg.cpMin; if not set, the search is backward from FINDTEXTEX.chrg.cpMin.
Microsoft Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always forward.
If set, the search differentiates between alefs with different accents. If not set, Arabic and Hebrew alefs with different accents are all matched by the alef character.
If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive.
If set, the search operation considers diacritical marks. If not set, Arabic and Hebrew diacritical marks are ignored.
If set, the search operation considers kashidas. If not set, Arabic and Hebrew kashidas are ignored.
If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for word fragments that match the search string.


A FINDTEXTEXW structure containing information about the find operation.

Return value

If the target string is found, the return value is the zero-based position of the first character of the match. If the target is not found, the return value is -1.


Use this message to find Unicode strings. For ANSI;, use EM_FINDTEXTEX.

The cpMin member of FINDTEXTEX.chrg always specifies the starting-point of the search, and cpMax specifies the end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a value of -1 in cpMax extends the search range to the end of the text.

If the search operation finds a match, the chrgText member of the FINDTEXTEX structure returns the range of character positions that contains the matching text.

EM_FINDTEXTEXW uses the FINDTEXTEXW structure, while EM_FINDTEXTW uses the FINDTEXTW structure. The difference is that EM_FINDTEXTEXW reports the range of text that was found.


Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]

See also