How can i disable mouse right clicking event

I need in my project to disallow any body to right click the mouse. Can i disable this event to prevent user of the application from right clicking if yes how can i disable it.

I have code written in Visual Basic doing the same task but i don't know how to transfer those code in java
The following is a code for that:
Option Explicit
'declares
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
'constant
Private Const WH_MOUSE_LL = 14&
Public Const HC_ACTION = 0&
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public Const VK_RBUTTON = &H2
Private lMShook As Long
Private bHookEnabled As Boolean
'functions which process mouse events
Public Function MouseProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If nCode = HC_ACTION Then
If (wParam = WM_RBUTTONUP Or wParam = WM_RBUTTONDOWN) Then
MouseProc = 1
Exit Function
End If
End If
MouseProc = CallNextHookEx(lMShook, nCode, wParam, lParam)
End Function
Public Function SetHook()
If lMShook = 0 Then
lMShook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf MouseProc, App.hInstance, 0&)
End If
If lMShook = 0 Then
MsgBox "failed to install hook :" & lMShook & " : " & WH_MOUSE_LL
bHookEnabled = False
Unload Form1
Exit Function
Else
bHookEnabled = True
End If
End Function
Public Function UnSetHook()
If bHookEnabled Then
Call UnhookWindowsHookEx(lMShook)
lMShook = 0
End If
bHookEnabled = False
End Function
Public Function InstalledHook()
MsgBox " installed hook is :" & lMShook
End Function
code for form is below:
Option Explicit
Private Sub Command1_Click()
InstalledHook
End Sub
Private Sub Command2_Click()
Call SetHook
End Sub
Private Sub Command3_Click()
Call UnSetHook
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call UnSetHook
End Sub

Similar Messages

  • How can i set no Right Click on Adf (jspx)

    hi to everyone in this thred i have a cuestion ,
    How can i set no Right Click on Adf (jspx)? i don´t find the solution for this event
    i know a JavaScript to cancel RightClick but , are no how can i use in adf of Jdeveloper 11?
    thanks ...

    Hi,
    there is no native API for this, so you will have to use JavaScript for this. What is the usecase ?
    Frank

  • How can I get the right click to work in firefox -- it works in internet explorer

    how can I get the right click to work in firefox -- it works in interne

    Try the Firefox SafeMode to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4/5/6/7 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    If it is good in the Firefox SafeMode, your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • How write Vbscript for Mouse Right Click using UFT 11.5

    how write Vbscript for Mouse Right Click using UFT 11.5

    Press and hold the Control (Ctrl) key while you click the mouse button. This is identical to right-clicking with a mouse. (Ctrl+click = Right click)
    You can try the following:
    •Click on and off the 'right click' checkbox in the Mouse System Preferences
    •Restart in Safe Mode
    •Reset NVRAM / PRAM

  • How can I modify the "right click" menu of a table control?

    Hello,
      How can I modify the "right click menu" of a table control. I would like to be able to remove the ability to add or delete columns and maybe other selections. I want to keep the ability to
    add or delete rows

    Hi Andy,
    Dialog & User Interface VIs -> Menu functions
    Never used them, eh?

  • Inside the browser, right click on the mouse seems to be disabled. How can I enable the right click button? It works fine on toolbars and tab bar but not inside tabs or windows. I would like to be able to copy and paste and such. Thank you

    Right mouse button does not open any menu when clicked inside of tabs or windows. Works properly on the toolbars, in the address line, search bar...etc. but has no action on the page I'm browsing. I purchased a mouse recently and like the old one, the right button works in all other areas of my operating system. I would like to know if there is a setting in firefox that I can change to correct this.

    There are also websites that can disable the right-click context menu.
    See Tools > Options > Content : JavaScript > Advanced > Allow Scripts to:
    [ ] "Disable or replace context menus"
    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Shockwave Flash 10.0 r42
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/

  • JPopupMenu - disabling mouse right click

    Hi,
    First of all, before I write the problem here, I searched a lot but I actually could not find the desired solution.
    The problem is;
    I have a JPopupMenu. As you know, all mouse clicks (left click, middle click and right click) do the selection in popup menu and then it tries to perform the related action. Finally, the popup menu disappears. But, what I want actually is that "my popup menu will not respond to the mouse right click and will not disappear after that right click".
    Can anyone say how to make that happen?
    Thanks a lot.

    The following is an example code, and I did not the details of how the popup menu showed. I just showed how the actions are added to the popup menu elements. In this example, in the popup menu there are Text1, Text2 and Text3 selections and their actions are added like in the code. So, my actions are seperate for each element in the popup menu. Now, how can I make the mouse right click will not enter the related selection's actionPerformed (e.g; Text1, Text2) and the popup menu will not disappear?
    public class JPopupMenuTest {
        public static void main(String[] args) {
            JPopupMenuTest popupTest = new JPopupMenuTest();
            JPopupMenu popupMenu = new JPopupMenu();
            popupMenu.add(popupTest.new Text1Action());
            popupMenu.add(popupTest.new Text2Action());
            popupMenu.add(popupTest.new Text3Action());
        class Text1Action extends AbstractAction {
            public Text1Action() {
                super("Text1");
            @Override
            public void actionPerformed(ActionEvent e) {
                // Here is the Text1 action performed
        class Text2Action extends AbstractAction {
            public Text2Action() {
                super("Text2");
            @Override
            public void actionPerformed(ActionEvent e) {
                //  Here is the Text2 action performed
        class Text3Action extends AbstractAction {
            public Text3Action() {
                super("Text3");
            @Override
            public void actionPerformed(ActionEvent e) {
                // Here is the Text3 action performed
    }

  • Disable Mouse Right click inside Adobe Acrobat PDF plugin

    Hi All,
    We are rendering Adobe live cycle pdf file inside html object tag.
    I have disabled toolbar , navigation bar using navpanes=0&toolbar=0.
    But when mouse right click reenable the context menu again.
    So Is there any way to disable mouse righ click inside Adobe Acrobat PDF browser plugin?

    I had the same problem after updating Firefox to version 4.0 and Acrobat Reader to Version X. For me (Win XP) what solve the problem was deleting the Acrobat Reader Plugin (nppdf32.dll) in the Firefox plugin folder (C:\Program Files\Mozilla Firefox\plugins). So now there is only one Acrobat Reader Plugin left namely the one in the Acrobat Reader plugin folder (C:\Program Files\Adobe\Reader 10.0\Reader\Browser).

  • MenuEditor addon ~ disables mouse right click

    I recently upgraded my PC from intel atom to intel i3.
    during reinstallment of firefox. i found that (after checking) the MenuEditor Addon disables my right click in firefox.
    Previously it used to work smoothly even in firefox v27, but now does not respond even in firefox v25.0
    can you please guide me for that
    regards,
    aebbee

    Try to disable hardware acceleration in Firefox (you need to close and restart Firefox).
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How can I disable mouse shortcuts (mission control, etc) in games?

    I just installed the new Deus Ex: Human Revolution from the App Store and I'd like to use the miltiple mouse buttons my  Logitech mouse has in my game. I can set up the controls to use various buttons in the game, but I also have the same mouse buttons set up in the System Preferences to be used for mouse shortcuts. The problem is, when I try to use the game, the "All Applications" or the "Show Desktop" shortcuts kick in instead of the games setup controls.
    How can I disable the Mouse Shortcuts for the system while I'm in the game?

    Forgive me... I should have said:
    How do I permenantly disable the shortcuts only while in the game, without having to redo my System Preferences every time I start or stop my game?

  • How can I disable the shift-click slow motion special effects in Mac OS 10.6?

    How can I disable the slow motion special effects that occur when you do something and hold shift? (By the way, the terminal command doesn't work in 10.6)

    I'd like to know how to do this now too since the terminal command doesn't work in Lion / ML. Anyone know how?
    And Leroy - the reason is because I have custom hot keys configured and the shift key is a key I want to use for this command. I would like to know how to disable the slow motion effect permanently since I never need it and would certainly like to use my shift key as a modifier for various keyboard commands.

  • How can i get a right-click click box to work?

    I am using Captivate 7 and to accurately mimic the software I have inserted multiple right-click click boxes but without success. After reading previous posts, I have tried the following:
    - publishing to SWF and HTML5
    - publishing to the default folder and launching the HTML from there (i can see .css and .js files in the folder as well)
    - unchecking "Enable Accessibility" in Publish Settings
    I'm very new to Captivate so any help or advice you can give on this would be great.
    Thanks
    bianca

    Read this post about Flash Global Security:
    http://www.infosemantics.com.au/adobe-captivate-troubleshooting/how-to-set-up-flash-global -security
    Not having the publish folder location set up as a trusted location can also cause right click to fail.

  • Accidentaly right clicked on a photo information how can I fix thisaccidentaly right clicked on a photo information

    accidentaly right clicked on a photo information. Hit something about not showing on facebook was not my intrntion. Now none of my photos or friends photos show up.

    Hi,
    Please see [https://support.mozilla.org/en-US/kb/Options%20window%20-%20Content%20panel this.] You can check in '''Tools''' ('''Alt''' + '''T''') > '''Options''' > '''Content''' > '''Exceptions''' (for images) and delete the address (I'm using another version but I think the method would be very similar). [https://support.mozilla.org/en-US/kb/Options%20window%20-%20Content%20panel Options > Content]
    If you blocked the image through an add-on, try right-clicking on an image on another website to find out the name of the add-on and open the add-on options to delete/disable the blocking rule. Alternatively you can also try via the '''Options''' for the add-on in '''Tools''' ('''Alt''' + '''T''') > '''Add-ons''' > '''Extensions''' (on the left). Clicking on '''More''' > '''Home Page''' would take you to the help/support site for the add-on.

  • How can I perform a right-click in boodcamp using Windows 7 Ultimate?

    Have not been able to perform a right click in Windows 7 using bootcamp.  Any solution? Have tried many combinations of fingers and keys to no avail.

    Use the BootCamp control panel to set trackpad preferences.

  • How can I edit the right-click context menu?

    I seem to have two entries for every Adobe product when I right-click a file and choose "Open With..." Is there a way to either clean it out automatically, or fix this myself?
    ...Mike

    Could be caused by several things I believe.
    You have already checked you have only one application folder with one Adobe
    app for each in it on your Disk?
    Also look in the preferences in Bridge under file type associations for the
    given extensions, do they also show double applications?
    Try first to refresh preferences with restart Bridge holding down option
    key, it is the first aid for Bridge and curing many problems.
    Also use Disk Utility to check and repair permissions for your OS.
    I seem to have two entries for every Adobe product when I right-click a file
    and choose "Open With..." Is there a way to either clean it out automatically,
    or fix this myself?

Maybe you are looking for

  • Slow performance since going to Mavericks on aging iMac

    hi & thanks in advance: Wondering if my newly sluggish performance, SPODs etc since upgrading to Mavs (10.9.2) from 10.6.8  =  its time to upgrade my machine (late '07 iMac i think). I'd just install more RAM but seems my 4gig is its ceiling? Activit

  • Problem with onSelect event for DropdownbyIndex in the IView

    Hello , I have an webdynpro for java application where I am using Dropdownby Index. I have associated onSelect event for the dropdown by index. When I launch the application in the standalone mode ( direct application launch) every thing works fine.

  • No emails in mail.app

    Hello, mail.app act weird since a few weeks. It doesnt show the emails for one particular account I have. Everything syncs, it shows the new mails I receive, but when I click on the mailbox, its empty. At some point, when I restarted the computer, it

  • Collection Data Form in invisible mode.

    Hi, We are using zcm 10.3 installed on SLES 11. Our clients are XP SP3. I have configured a collection data form with autofill and checked "Invisible mode for autofill only" In the autofill settings I have entered a environment variable. I have confi

  • Import Integration Script

    Hello Guys, I want to pull the specific data from two different tables from oracle database . what should i do ? is it possible to import data from two different tables using import integration script or i need to write SQL query for this ? Any one h