Disable Right Click shortcutkey on keyboard.

Is there a way to disable the rightclick shortcut key (found on the right side on my keyboard beside the right-CTRL key)? Menu always pops-up when Im on my textBox and MaskeditTextbox and I want to remove it.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

caraf_gConnect With a Mentor Commented:
Never thought this would be so awkward!

Here's a solution.

Create a picture box on your form, and set its tabstop property to false. Set its left property to a large negative value so the user will never see the control.

Then paste in the following code:

Option Explicit
Private mobjLastControl As Object
Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer)


End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 93 Then
    Set mobjLastControl = Text1
End If

End Sub
Hello puruknoy,

Seeing that you're quite new to the site and you've already awarded a "C", I would appreciate it if you could read the following URL: http://oldlook.experts-exchange.com/bin/Q.10220959 

This is not a reflection on you and does not oblige you to any course of action. Just want to raise awareness.
Did you want to replace it with one of your own or just get rid of the right click for a textbox..mskedit completely.
You can hook the popup and add your own menu if you wish.

'get rid of popup for text box on right click
'<<<<<<<<<< put this in a bas module  >>>>>>>>>>>>>>>>>>

Option Explicit

Public 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

Public Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Public Const GWL_WNDPROC = -4
Public Const WM_RBUTTONUP = &H205
Public lpPrevWndProc As Long
Public lngHWnd As Long

Public Sub Hook(hWnd As Long)
lngHWnd = hWnd
lpPrevWndProc = SetWindowLong(lngHWnd, GWL_WNDPROC, _
AddressOf WindowProc)
End Sub

Public Sub UnHook()
Dim lngReturnValue As Long
lngReturnValue = SetWindowLong(lngHWnd, GWL_WNDPROC, _
End Sub

Public Function WindowProc(ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Select Case uMsg
  'Do nothing
  'Or popup your menu Your Code goes here
Case Else
  WindowProc = CallWindowProc   (lpPrevWndProc, hw, _
uMsg, wParam, lParam)
End Select
End Function

' <<<<<<<<<<<<<<<<   form code  >>>>>>>>>>>>>>>>>>>>>

'Add the following code to the Form_Load event of the form where the text box is placed:

Call Hook(Text1.hWnd)
'Where Text1 is the name of the text box you want to Subclass.

'Add the following code to the Form_Unload event:

Call UnHook

Juilette - puruknoy is not talking about the right mouse button but about the popup menu button that you'll find on the newfangled Windows keyboards.
Oooops...No biggie..been wrong on more than one occassion in my life.

Ps...guess I need some new equipment.
All Courses

From novice to tech pro — start learning today.