Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Disable Right Click Popup Menu
Author:
Nikunj Bhatt
E-mail:
Click to e-mail author
Website:
http://nikunjbhatt.blogspot.com
Submitted:
8/5/2008
Version:
VB6
Compatibility:
VB6
Category:
Controls
Views:
18465
This is can be used for many type of controls, mainly for textbox, to make the user unable to open the right click popup menu. User will need only an extra Timer control for this. No need for SendMessage, Hooking or any other API. Put a Timer control in the Form, disable it, set its interval to 222. You can try the interval with different values. Remember, using this code you can not completely disable the popup menu, but code can work for the time interval you set (in the timer) after the end user presses the right mouse button.
Declarations:
Dim TBox As Control
Code:
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Text1.Enabled = False Set TBox = Text1 Timer1.Enabled = True End If End Sub Private Sub Timer1_Timer() TBox.Enabled = True TBox.SetFocus Timer1.Enabled = False End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement