This is how to send a right click to a textbox from another controls event.
VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
  4. ByVal wParam As Long, ByVal lParam As Long) As Long
  5.  
  6. Private Const WM_KEYDOWN = &H100
  7. Private Const WM_KEYUP = &H101
  8.  
  9. Private Const WM_RBUTTONDOWN As Long = &H204
  10. Private Const WM_RBUTTONUP As Long = &H205
  11. Private Const MK_RBUTTON As Long = &H2
  12.  
  13. Private Sub Command1_Click()
  14.     Dim DaWord As Long
  15.     DaWord = MakeDWord((Text1.Width / 15) / 2, (Text1.Height / 15) / 2) 'Centers the click and 15 is twips per pixel
  16.     SendMessage Text1.hwnd, WM_RBUTTONDOWN, 2&, ByVal DaWord
  17.     SendMessage Text1.hwnd, WM_RBUTTONUP, 2&, ByVal DaWord
  18. End Sub
  19.  
  20. Private Function MakeDWord(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long
  21.     MakeDWord = (HiWord * &H10000) Or (LoWord And &HFFFF&)
  22. End Function