Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling right mouse button

Status
Not open for further replies.

Sashanan

Programmer
Jan 19, 2001
235
NL
As a final touch to my application, I want to prevent the use of the right mouse button on any of my objects. (This is to prevent, among other things, the deletion of text from locked textfields by using "Undo changes").

Is there an easy way to prevent the right mouse button from being used at all on any of my forms and objects? I assume it would involve a bit of code in my main module that is executed upon starting the application, but what would it look like?

Thanks in advance!
"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)
 
In the mousedown or mouseup events, check for button
2 like in the following...

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 2 Then
MsgBox "right clicked"
Else
MsgBox "left clicked"
End If

End Sub

Hope this helps,
Dragnut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top