Olav
2010-08-31 12:20:59 UTC
Anyone here who is experienced with Rich Edit Controls?
I'm having problems with the %EM_FINDTEXTEX message. The problem is that it
reports not found no matter how I try to do it.
Anyone any clue/tips to share?
LOCAL ft AS FINDTEXTEX
LOCAL FoundAt as long
'local szFind as asciiz * 1024
'szFind = varptr(SearchTerms(1)) ' SearchTerms(1) is a dynamic string
value
ft.lpstrText = STRPTR(SearchTerms(1)) 'szFind
ft.chrg.cpMin = 0 ' search from start
ft.chrg.cpMax = -1 ' to the end of the document.. I believe
FoundAt = Sendmessage(hEdit,%EM_FINDTEXTEX,%FR_DOWN,VARPTR(ft))
IF ft.chrgText.cpMin = -1 AND ft.chrgText.cpMax = -1 THEN
? "NOT FOUND"
END IF
IF FoundAt <> -1 THEN
' if the search operation finds a match, the chrgText member of the
FINDTEXTEX structure returns the range of
' character positions that contains the matching text.
? "FOUND"
END IF
$DEBUG PRINT "FoundAt:" + STR$(FoundAt)
--
Olav
I'm having problems with the %EM_FINDTEXTEX message. The problem is that it
reports not found no matter how I try to do it.
Anyone any clue/tips to share?
LOCAL ft AS FINDTEXTEX
LOCAL FoundAt as long
'local szFind as asciiz * 1024
'szFind = varptr(SearchTerms(1)) ' SearchTerms(1) is a dynamic string
value
ft.lpstrText = STRPTR(SearchTerms(1)) 'szFind
ft.chrg.cpMin = 0 ' search from start
ft.chrg.cpMax = -1 ' to the end of the document.. I believe
FoundAt = Sendmessage(hEdit,%EM_FINDTEXTEX,%FR_DOWN,VARPTR(ft))
IF ft.chrgText.cpMin = -1 AND ft.chrgText.cpMax = -1 THEN
? "NOT FOUND"
END IF
IF FoundAt <> -1 THEN
' if the search operation finds a match, the chrgText member of the
FINDTEXTEX structure returns the range of
' character positions that contains the matching text.
? "FOUND"
END IF
$DEBUG PRINT "FoundAt:" + STR$(FoundAt)
--
Olav