CRichEditCtrl::FindText怎么使用?

VC编程
2025-06-23 02:27:22
推荐回答(1个)
回答1:

试试这个
extern CRichEditCtrl* pmyRichEditCtrl;

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);