tpine Posted April 23, 2010 Share Posted April 23, 2010 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 LongEnd TypePublic Const EM_CHARFROMPOS = &HD7Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _ lParam As Any) As LongThen 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 LongDim pt As PointAPIpt.x = x \ Screen.TwipsPerPixelXpt.y = y \ Screen.TwipsPerPixelYlPos = 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.EndIfEnd SubI 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 More sharing options...
Mijzelf Posted April 23, 2010 Share Posted April 23, 2010 VB is hard to read for me, but I *think* you have to pass pt ByRef. In C it should have to be a pointer to the struct. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now