From: Karl E. Peterson on
Mayayana expressed precisely :
> Function Find(ByVal sText As String, ByVal LStart As Long, ByVal LEnd As
> Long, ByVal LOpts As Long) As Lon
> Dim Ft As FINDTEXT
> Dim LRet As Long
> Dim s As String
> With Ft
> .chrg.cpMin = LStart
> .chrg.cpMax = LEnd
> End With
> s = StrConv((sText & vbNullChar), vbFromUnicode)
> Ft.lpstrText = StrPtr(s)
> LRet = SendMessageAny(hRTB, EM_FINDTEXT, ByVal LOpts, Ft)
> Find = LRet
> End Function
>
> You have to also watch for direction. Starting with
> RichEdit v. 2, backward search is possible, and it's
> the default! Add 1 to wParam for forward search.

Looking like this one isn't supported by dirt-standard 'edit' controls?

> So, if I've got it right, it's now possible to call up
> a bland-looking system Find/Replace window and
> find given text in an RTB....in less than 5 pages of code.

LOL! Something like that, yeah. But hey, it's still a bit less than a
fully functional FileOpen/Save dialog box. ;-)

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Karl E. Peterson on
Kevin Provance was thinking very hard :
> I think I found the perfect solution to this, solving all our match case and
> whole word problems. Thing is, it needs to be a RTB. Notepade doesn't
> support whole word flags.
>
> Want to change this to a RTB example?

Probably wouldn't hurt to have routines that handled either. I can
sure see folks wanting to go both ways. I know I've only used RTBs in
a handful of apps ever, myself, even though a whole lot of other folks
use them routinely. (It's the external dependency that bothers me,
personally.)

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Karl E. Peterson on
It happens that Kevin Provance formulated :
> "Leo" <ttdhead(a)gmail.com> wrote in message
> news:i0h41b$sgj$1(a)news.eternal-september.org...
>>
>> I think it would be nice to still have it work with a textbox as thats
>> what my app currently uses, but I may convert it to a RTB if I can work
>> out issues.
>
> Good news and bad news.
>
> The good news is the search and seek of text within a RTB can be done with a
> few lines of code, using API.
>
> Bad news, this will not work on a regular text box with the API solution.
> Will see if I can come up with something similar.
>
> In the meantime (tomorrow) I'm going to send Karl a copy of his code with
> the RTB replacement and the API and see if it's of any use to him.

Cool.

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Bruce2u2 on
Karl makes a very good point about making your apps look good with the
current operating system. My search and replace forms from 1997 might
look outdated in current apps. I'm not sure why it took me so long to
fail to find this solution way back when. It looks simple in the code.
Maybe I didn't figure out about IsDialogMessage. In any case, I'm glad
you figured it out.

Kevin, thanks for the compliment on my book. It's been a long time.

Bruce
From: Mayayana on
| Looking like this one isn't supported by dirt-standard 'edit' controls?
|

No. I don't know how to tell which EM_* messages
are supported where except by checking each one in the
docs. EM_FINDTEXT, and many others, say "....within a
rich edit control".