Help Center

CRichEditCtx.FindTextmethod

Finds text within a rich edit control.

Windowsmethoddocumented

Syntax

FUNCTION FindText OVERLOAD (BYVAL fOptions AS DWORD, BYREF ft AS FINDTEXTW) AS LONG
FUNCTION FindText OVERLOAD (BYVAL fOptions AS DWORD = FR_DOWN, BYVAL cpMin AS LONG = 0, BYVAL cpMax AS LONG = -1, BYREF wszText AS WSTRING) AS LONG

Parameters

NameDescription
fOptionsSpecifies the parameters of the search operation. This parameter can be one or more of the following values.
FR_DOWN. If set, the operation searches from the end of the current selection to the end of the document. If not set, the operation searches from the end of the current selection to the beginning of the document.
FR_MATCHALEFHAMZA. By default, Arabic and Hebrew alefs with different accents are all matched by the alef character. Set this flag if you want the search to differentiate between alefs with different accents.
FR_MATCHCASE. If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive.
FR_MATCHDIAC. By default, Arabic and Hebrew diacritical marks are ignored. Set this flag if you want the search operation to consider diacritical marks.
FR_MATCHKASHIDA. By default, Arabic and Hebrew kashidas are ignored. Set this flag if you want the search operation to consider kashidas.
FR_WHOLEWORD. 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.
ftA FINDTEXTW structure containing information about the find operation.
cpMinCharacter position index immediately preceding the first character in the range.
cpMaxCharacter position immediately following the last character in the range. If the cpMin and cpMax members are equal, the range is empty. The range includes everything if cpMin is 0 and cpMax is –1.
pwszTextA WSTRING containing the text to find.

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.

Search in a range: Search in the entire document: Case sensitive search: Search backwards from the end of the document to the beginning:

Description

Overloaded method to find text within a rich edit control.

Examples

DIM dws AS DWSTRING = "box" DIM cbStart AS LONG = pRichEdit.FindText(FR_DOWN, 5, 20, cws) pRichEdit.ExSetSel(cbStart, cbStart + LEN(dws))

DIM dws AS DWSTRING = "box" DIM cbStart AS LONG = pRichEdit.FindText(FR_DOWN, 0, -1, dws) --or-- DIM cbStart AS LONG = pRichEdit.FindText(FR_DOWN, , , dws) pRichEdit.ExSetSel(cbStart, cbStart + LEN(cws))

DIM wws AS DWSTRING = "box" DIM cbStart AS LONG = pRichEdit.FindText(FR_DOWN OR FR_MATCHCASE, 5, 20, cws) pRichEdit.ExSetSel(cbStart, cbStart + LEN(wws))

DIM cbStart AS LONG = pRichEdit.GetTextLength DIM cbStart AS LONG = pRichEdit.FindText(0, cbStart, 0, cws) pRichEdit.ExSetSel(cbStart, cbStart + LEN(cws))

Reference

  • Defined in AfxNova/CRichEditCtx.inc:2037
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class