I've actually thought about this problem before so thanks for bringing it up so that I could think about it again. Here is some code that will move the cursor position to the spot where you right clickNow it is just like the left mouse buttonVB Code:
Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const WM_USER = &H400 Private Const EM_CHARFROMPOS = WM_USER + 39 Private Type POINTL x As Long y As Long End Type Private Sub RTB_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim mypoint As POINTL Dim Index As Long If Button = vbRightButton Then mypoint.x = ScaleX(x, vbTwips, vbPixels) mypoint.y = ScaleY(y, vbTwips, vbPixels) Index = SendMessage(RTB.hwnd, EM_CHARFROMPOS, 0, mypoint) RTB.SelStart = Index End If End Sub




Reply With Quote