Solved

Can system right-click invoked pop-up menu be disabled?

Posted on 1998-12-04
5
139 Views
Last Modified: 2012-05-04
Is it possible with VB5 to disable the system pop-up menu that appears when right-clicking on a text box?  The Paste option allows the user to circumvent validation in my app.  If not, can an application be instructed to ignore right-mouse clicks?  
0
Comment
Question by:craigdawson
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:traygreen
ID: 1448254
Try this in the mouse down event for the controls in question...

Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If Button = 2 And Shift = 0 Then
      Button = 0
      MsgBox "Mouse Down"
   End If

End Sub

or put the code in a global routine
Public sub SupressPopup(Button As Integer, Shift As Integer)
   If Button = 2 And Shift = 0 Then
      Button = 0
      MsgBox "Mouse Down"
   End If
end sub

and put ...
Call SupressPopup(Button, Shift) in the mousedown events

0
 

Author Comment

by:craigdawson
ID: 1448255
Popup menu still appears.
0
 
LVL 3

Accepted Solution

by:
traygreen earned 50 total points
ID: 1448256
Are you getting the message "Mouse Down"?  If not you do not have the code in all of the controls.  You need to put the code in each of the controls on which you wish to suppress the popup menu.
Email me your form if you would like and I can take a look and see if there is anything weird going on. (traygreen@hotmail.com)
0
 

Author Comment

by:craigdawson
ID: 1448257
Sorry, I should have been more clear.  It works as long as the msgbox is there but not once that line is removed.  I can't have message boxes popping up on every right-click so I still have no solution.
0
 
LVL 2

Expert Comment

by:BergJC
ID: 1448258
CraigDawson,
    What I've had to do in the past is create my own popup menu and use it in place of the default popup menu. It's usually just a bogus menu item (HELP, for example). To do this, create a menu item, we'll call it mnuTest for this example. Click off "visible", so that it doesn't show in your application. Then you must have at least one subitem, so create a menu item underneath mnuTest called mnuHelp. It must be visible (too bad, too, because that would solve our problem).

Then, in your TextBox MouseDown event, put this:

If Button = 2
    Text1.Enabled = False
    PopupMenu mnuTest
    Text1.Enabled = True
    Text1.SetFocus
End-if

Your new popupmenu will display instead of the default, and it won't have Paste. You'll obviously have to display the help file, or whatever bogus thing you did put on your menu, but it effectively prevents them from using the Paste command, and doesn't look bad. It's an alternative to preventing all right mouse clicks.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

746 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

16 Experts available now in Live!

Get 1:1 Help Now