Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB5 RTF Find Text on screen position

Posted on 1998-02-18
3
Medium Priority
?
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Suggested Courses

715 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