Solved

Disable Mouse-right click

Posted on 1998-06-17
9
178 Views
Last Modified: 2010-05-03
I am using VB5.0 with MSSQLServer6.5. In my applicaion I want to disable the right click button of the mouse. I would wait for an early reply.
0
Comment
Question by:rolee
  • 5
  • 4
9 Comments
 

Author Comment

by:rolee
ID: 1463498
Edited text of question
0
 

Accepted Solution

by:
Renes earned 30 total points
ID: 1463499
To disable the right mouse button, you can use an Api call like I've done
Put this in the general declarations:
Public Const WM_RBUTTONDOWN = &H204

And put this in the mousedown event of an object:
If Button = 2 Then
Call Sendmessage(Me.hwnd, WM_RBUTTONDOWN, 0, 0&) 'Disable right mouse-button
Hope it works, if it doesn't you can comment me
0
 

Author Comment

by:rolee
ID: 1463500
It works fine for single click thru right button. But I doubleclicked by chance and I could see all options listed. Can I disable this bouble click from right button too.

Thanks for the information.
0
 

Expert Comment

by:Renes
ID: 1463501
Simply by putting it in the Dblclick event for the object

This is my code:

Private Sub DblClick()
Call Sendmessage(Me.hwnd, WM_RBUTTONDOWN, 0, 0&)    'do not show the standard cut and paste menu
End Sub

Let me know if it works..
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:rolee
ID: 1463502
It works fine for single click thru right button. But I doubleclicked by chance and I could see all options listed. Can I disable this bouble click from right button too.

Thanks for the information.
0
 

Expert Comment

by:Renes
ID: 1463503
Simply by putting it ALSO in the Dblclick event for the object

This is my code:

Private Sub DblClick()
Call Sendmessage(Me.hwnd, WM_RBUTTONDOWN, 0, 0&)    'do not show the standard cut and paste menu
End Sub



Let me know if it works..
0
 

Author Comment

by:rolee
ID: 1463504
yes it works fine. Thanks for your help. As I have many textfields in the application, I am required to write the above code for each field, which could be time consuming. Is there anyway to disable the rightclick at one point and it remains disable through out the form until it is enabled through code again. I don't want to take too much of your time. If there is a possibility, please let me know otherwise I will do for each field.

Thanks anyway for your immediate answer.

0
 

Expert Comment

by:Renes
ID: 1463505
If you have many textfields on a form that basicly do the same thing (I don't know if that is the case, but the mouse menu ignore is the same) than you should try to make an array out those textfields so that you can use the 'index' property in the textfields. Like text(1), Text(2), Text(3), Text(4).......

You than can create one event that can handle all the textfields
text(index)_mousedown or something like that. Put the line of code in there and it should work.

There is an example calculator in vbsamples that also works with the (index) for the buttons. Button_click(index as integer)
It has one event for all buttonclicks so look at that if you don't know what I mean..

Don't know if this helps, but could you grade me please it is only twenty points but.....

Goodluck

0
 

Author Comment

by:rolee
ID: 1463506
Thanks. I have got the idea. In future, may be, I will use this concept as it could be quite time consuming and risky to change the application.

Thanks anyway. I have increased the points along with grading.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 67
Excel object stays open 19 71
Error when passing an argument to a vb6 that contains  '/' 7 31
TT Auto Dashboard 13 84
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now