Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB5 RTF Find Text on screen position

Posted on 1998-02-18
3
Medium Priority
?
202 Views
Last Modified: 2008-03-03
I need help finding the part of the text that is on screen.
I know how to find the Selected Text EVERYTHING and to find
text in a search and to tell the twip coordinates of the box.  What I need most is the character number which
appears in the upper left of the box, length or
character postion of the last text showing would be a
plus.              ;-)   Dave McAn
0
Comment
Question by:davemcan
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 1000 total points
ID: 1457404
Dim lngPos As Long
Dim lngResultFirst As Long
Dim lngLine As Long
Dim lngChar As Long
Dim strHex As String

    lngPos = 0  'low bit for X coord, 0 high bit for Y coord
    lngResultFirst = SendMessage(RichTextBox1.hwnd, EM_CHARFROMPOS, 0, lngPos)

lngChar = lngResultFirst And (2 ^ 16 - 1)
strHex = Right$(String(8, "0") & Hex$(lngResultFirst), 8)
lngLine = CLng("&H" & Left$(strHex, 4))


the line is relative the top of the control
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1457405
One thing I noticed is that the vertical scrollbar must be turned on for this to work.

Anthony
0
 

Author Comment

by:davemcan
ID: 1457406
Thanks, but boy do I have my work cut out for me.  I still need
the horizontal length, and to be able to correlate with another
RTF control with different line lengths, and of course the box
length can vary with the resizable form.  Any other suggestions?
                   ;-)   Dave McAn
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question