Solved

VB5 RTF Find Text on screen position

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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
SQL VB connection works in one PC and doesn't in another 15 80
TT Auto Dashboard 13 104
Problem to line 23 81
how to read data from all excel sheet and copy it in in Master sheet 2 28
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

752 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