Solved

VB5 RTF Find Text on screen position

Posted on 1998-02-18
3
189 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 250 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now