ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Coding Snacks

Disable right mouse button and enable only for specific program

(1/3) > >>

Hi, I was wondering if someone could help me with a AHK script that disables the right mouse button, but only enables it within a certain program that is running.
So if the program is active the user can only use the right mouse button within this specific program, trying the right mouse button on the taskbar, start menu button, desktop or even a other program other then mentioned is not allowed..

Thx in advanced!

you can use GroupAdd and #IfWinActive to achieve what you want.

here's an example.

--- Code: Autohotkey ---GroupAdd, $NoRightClick, Foxit PDF Editor        GroupAdd, $NoRightClick, ahk_class Notepad GroupAdd, $NoRightClick, ahk_class IEFrame #IfWinActive ahk_group $NoRightClick;Disable right clickRButton::Return#IfWinActive

Hi lanux128, Thx for your quick reply.
Your solution is not exactly what I was looking for. I want to disable the right mouse click for everything, it should only work if a specific program (prog32.exe) is active.
Your solution is only blocking the right mouse button for specified programs.

Does the prog32.exe have a corresponding window title?

If I look it up with AHK, it is ahk_class ProMainWin


[0] Message Index

[#] Next page

Go to full version