다음을 통해 공유


CRichEditCtrl::FindText

long FindText( DWORD dwFlags**, FINDTEXTEX*** pFindText ) const;

Return Value

Zero-based character position of the next match;  – 1 if there are no more matches.

Parameters

dwFlags

Flags for the match criteria. Can be zero or more of the following values:

  • FR_MATCHCASE   Indicates that the search is case sensitive.

  • FR_WHOLEWORD   Indicates that the word boundaries should be considered in the search.

pFindText

Pointer to the structure giving the parameters for the search and returning the range where the match was found.

Remarks

Call this function to find text within the rich edit control. You can search either up or down by setting the proper range parameters in the structure within the FINDTEXTEX structure.

For more information, see message and structure in the Win32 documentation.

Example

// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
// The string to search for.
extern LPCTSTR lpszmyString;

// Set the selection to be the first occurrence of the
// string lpszmyString, if it is found.
FINDTEXTEX ft;
ft.chrg.cpMin = 0;
ft.chrg.cpMax = -1;
ft.lpstrText = (LPSTR) lpszmyString;
long n = pmyRichEditCtrl->FindText(FR_MATCHCASE|FR_WHOLEWORD, &ft);
if (n != -1)
   pmyRichEditCtrl->SetSel(ft.chrgText);

CRichEditCtrl OverviewClass MembersHierarchy Chart

See Also   CRichEditCtrl::SetSel