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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.