How do I use this message in VB.NET. I have sendmessage declared and it works with other messages, just not this one.
the x and y values are grabbed from the MouseMove function and passed over to this code. When it goes to run the " = SendMessage(rtbData.Handle, EM_CHARFROMPOS, 0&, pt)" part, I get an Invalid parameter error or something... whats up? Everything is declared. This is how you did it in VB6...exactly how.
For some reason all the "p o s" (without the spaces) were replaced with three whitespaces.
Code:
Public Function GetWordUnderCursor(ByVal x As Integer, ByVal y As Integer) As String
Dim pt As PointAPI
Dim As Integer
Dim ch As String
Dim txt As String
Dim txtlen As Integer
Dim _start As Integer
Dim _end As Integer
pt.x = x
pt.y = y
position of character under cursor
= SendMessage(rtbData.Handle, EM_CHARFROMPOS, 0&, pt) This shyt wont ing work!
If <= 0 Then
Exit Function
End If
txt = rtbData.Text
get start position of word under cursor
For _start = To 1 Step -1
ch = Mid$(txt, _start, 1)
If ch = Chr(32) Or ch = vbCr Or ch = vbLf Or ch = vbNewLine Then Exit For
Next _start
_start = _start + 1
get end position of word under cursor
txtlen = Len(txt)
For _end = To txtlen
ch = Mid$(txt, _end, 1)
If ch = Chr(32) Or ch = vbCr Then Exit For
Next _end
_end = _end - 1
End Function
the x and y values are grabbed from the MouseMove function and passed over to this code. When it goes to run the " = SendMessage(rtbData.Handle, EM_CHARFROMPOS, 0&, pt)" part, I get an Invalid parameter error or something... whats up? Everything is declared. This is how you did it in VB6...exactly how.
For some reason all the "p o s" (without the spaces) were replaced with three whitespaces.
Last edited by a moderator: