Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using SendMessage to Find Text in a nonowned RichText ctrl
#1
I need to be able to find text in the rich edit control of another application.
Unfortunately, ctrl-F is being eaten by the application.
I thought I'd send a EM_FINDTEXT to the ctrl.
I'm not succeeding.
Anyone have a clue what I'm doing wrong?

Code:
Copy      Help
;/Insert Rich Text
function# hwndctrl str'texttofind

TEXTRANGE* tr=share
TEXTRANGE* tr2=share(hwndctrl)
memset(tr 0 sizeof(TEXTRANGE))
int stringoffset=sizeof(TEXTRANGE)+20
lpstr txt = tr+stringoffset
lpstr txt2 = tr2+stringoffset

tr.chrg.cpMin = 0
tr.chrg.cpMax = -1
strcpy(txt texttofind);; copy the string into shared space
out tr.chrg.cpMin
out tr.chrg.cpMax
out txt

tr.lpstrText = txt2;; address needs to be in nonowned control's space
int result=SendMessage(hwndctrl EM_FINDTEXT 0 tr2)
out result
ret result


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)