08-28-2006, 05:46 AM
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?
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?
;/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