Solved

VB5 RTF Find Text on screen position

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 56
Recommendation vb6 to vb.net or others 14 178
Added a column screws up code 5 63
How to read File Date Created using VB6 8 52
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…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

830 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