CRichEditView::FindText

BOOL FindText( LPCTSTR lpszFind**, BOOL** bCase = TRUE, BOOL bWord = TRUE );

Return Value

Nonzero if the lpszFind text is found; otherwise 0.

Parameters

lpszFind

Contains the string to search for.

bCase

Indicates if the search is case sensitive.

bWord

Indicates if the search should match whole words only, not parts of words.

Remarks

Call this function to find the specified text and set it to be the current selection. This function displays the wait cursor during the find operation.

Example

void CMyRichEditView::OnReplaceAll( LPCTSTR lpszFind,
            LPCTSTR lpszReplace, BOOL bCase, BOOL bWord )
{
   CWaitCursor wait;
   // no selection or different than what we are looking for
   if (!FindText(lpszFind, bCase, bWord))
   {
      CRichEditView::OnTextNotFound( lpszFind );
      return;
   }

   GetRichEditCtrl().HideSelection(TRUE, FALSE);
   m_nNumReplaced = 0;
   do
   {
      GetRichEditCtrl().ReplaceSel(lpszReplace);
      m_nNumReplaced++;  // Record the number of replacements

   } while (FindTextSimple(lpszFind));
   GetRichEditCtrl().HideSelection(FALSE, FALSE);
}

CRichEditView OverviewClass MembersHierarchy Chart

See Also   CRichEditCtrl::FindText, CRichEditCtrl::SetSel, CRichEditView::FindTextSimple, CWaitCursor