return FALSE ;
GetWindowText (hwndEdit, pstrDoc, iLength + 1) ;
// Search the document for the find string
pstrPos = _tcsstr (pstrDoc + * piSearchOffset, pfr->lpstrFindWhat) ;
free (pstrDoc) ;
// Return an error code if the string cannot be found
if (pstrPos == NULL)
return FALSE ;
// Find the position in the document and the new start offset
iPos = pstrPos - pstrDoc ;
* piSearchOffset = iPos + lstrlen (pfr->lpstrFindWhat) ;
// Select the found text
SendMessage (hwndEdit, EM_SETSEL, iPos, * piSearchOffset) ;
SendMessage (hwndEdit, EM_SCROLLCARET, 0, 0) ;
return TRUE ;
BOOL PopFindNextText (HWND hwndEdit, int * piSearchOffset)
{
FINDREPLACE fr ;
fr.lpstrFindWhat = szFindText ;
return PopFindFindText (hwndEdit, piSearchOffset, &fr) ;
}
BOOL PopFindReplaceText (HWND hwndEdit, int * piSearchOffset, LPFIND,REPLACE pfr)
{
// Find the text
if (!PopFindFindText (hwndEdit, piSearchOffset, pfr))
return FALSE ;
// Replace it
SendMessage ( hwndEdit, EM_REPLACESEL, 0, (LPARAM) pfr->
lpstrReplaceWith) ;
return TRUE ;
}
BOOL PopFindValidFind (void)
{
return * szFindText != '\0' ;
}