Jump to content

riched20.dll system error on em_charfrompos


Recommended Posts

Hi All - Looking for any suggestions one how to solve this problem. I wrote this program in VB6 and use the Sendmessage Api with EM_CHARFROMPOS to get the char position in a richtextbox from the cursor position (x,y) in order to identify the position when the mouse is moved over the richtextbox.

The program works 100% while I'm testing it, but when it is compiled, the .exe gives a windows systems error (you know the ones where you can send an error report to microsoft). This info identifies riched20.dll as the active process when the error occurred.

I tried switching to various versions of riched.dll, but the error persists. I wrote a second program, doing nothing else but to follow the mouse position in a richtextbox, with the same error result when I compile the program.

Can anyone give me any idea of what to do to get to the source of the problem? Any similar experiences? The code I've used look like this:-

In a module I declare:-

Public Type PointAPI

X as Long

Y as Long

End Type

Public Const EM_CHARFROMPOS = &HD7

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _

lParam As Any) As Long

Then in the richtextbox mouse_move sub:-

Private Sub rchNote_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

Dim lPos As Long

Dim pt As PointAPI

pt.x = x \ Screen.TwipsPerPixelX

pt.y = y \ Screen.TwipsPerPixelY

lPos = SendMessage(rchNote.hwnd, EM_CHARFROMPOS, ByVal CLng(0), ByVal pt)

if lPos >= 0 then

' Now here I look to see whether the mouse is over text with a hyperlink and change the mouse pointer to a hand and put the hyperlink in the ' tooltiptext property.

EndIf

End Sub

I took the code after the SendMessage call out, doing nothing further, and still get the error.

Any ideas? What am I missing? As I said, riched20.dll does not seem to be corrupted, as I tried various versions.

Thanks for your help.

tpine

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...