when I click on a textbox with my right mousebutton I get a little menu(with undo, copy, pasten etc). I do not want to see this menu. I just want that some code is excecuted on right mouse click. is there any way to hide this menu?
Printable View
when I click on a textbox with my right mousebutton I get a little menu(with undo, copy, pasten etc). I do not want to see this menu. I just want that some code is excecuted on right mouse click. is there any way to hide this menu?
you could try doing a SetFocus but you will probably get the menu flash for a split second if it worked.
On the code where it says the RightMouseClick, put
TextBox1.SetFocus and see if it takes he menu away.
then put ur code for ur right mouse click after it. good luck
VB Code:
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Const GWL_WNDPROC = (-4) Const WM_RBUTTONDOWN = &H204 Global WndProcOld As Long Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long If wMsg = WM_RBUTTONDOWN Then Exit Function WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&) End Function Sub SubClassWnd(hwnd As Long) WndProcOld& = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindProc) End Sub Sub UnSubclassWnd(hwnd As Long) SetWindowLong hwnd, GWL_WNDPROC, WndProcOld& WndProcOld& = 0 End Sub 'Add To a Form With a TextBox (called Text1) Private Sub Form_Load() SubClassWnd Text1.hwnd End Sub Private Sub Form_Unload(Cancel As Integer) UnSubclassWnd Text1.hwnd End Sub
picked this up somewhere... not sure where though...