Page 1 of 1
using #EM_FINDTEXT
Posted: Sat Sep 18, 2004 10:19 am
by Yian_The_Craft
Hey guys I really need some help on how to use
#EM_FINDTEXT
http://msdn.microsoft.com/library/defau ... ndtext.asp
The lpstrText is what is confusing me...is a callback needed?Or some peek/poke commands?
Posted: Sat Sep 18, 2004 11:22 am
by GreenGiant
Here's some quick and easy code that should show you how to use the message. You basically just specify a start and end for the search and the word to find.
Code: Select all
OpenWindow(0,0,0,400,400,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"test")
CreateGadgetList(WindowID(0))
EditorGadget(0,10,10,380,350)
For a=0 To 20
AddGadgetItem(0,a,"This is line "+Str(a))
Next
ButtonGadget(1,10,370,380,20,"Click to find the word 'line'")
word$="line"
text.FINDTEXT
text\chrg\cpmin=0
text\chrg\cpmax=1000
text\lpstrText=@word$
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget And EventGadgetID()=1
Repeat
res=SendMessage_(GadgetID(0),#EM_FINDTEXT,#FR_DOWN | #FR_WHOLEWORD,@text.FINDTEXT)
Debug res
text\chrg\cpmin=res+1
Until res<0
text\chrg\cpmin=0
EndIf
Until ev=#PB_Event_CloseWindow
But if you're using it for something real, you might want to put a real top value in, rather than just putting a thousand like I did

Posted: Sat Sep 18, 2004 12:55 pm
by Yian_The_Craft
could the last parameter of the #EM_ message not simply be
?
Posted: Sat Sep 18, 2004 5:23 pm
by GreenGiant
Yeah, it probably could. Just my coding style I guess. Probably silly, but I keep it like that so that at a glance I know that its a pointer and that its a structure. Just helps me when I need to change things and I can glance at it and remember what's going on.