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

DonationCoder.com Software > Coding Snacks

Disable right mouse button and enable only for specific program

<< < (2/3) > >>

skwire:
Give this a try:


--- Code: Autohotkey ---#IfWinNotActive, ahk_class ProMainWin{    ; Disable right click    RButton::Return}#IfWinNotActive

-Huub-:
Hi Skwire, this almost works! If the program window (ahk_class ProMainWin) is active and I go to the toolbar for instance, I can still rightclick.. If  the program window (ahk_class ProMainWin) isn't active it works great. Would it be possible to adjust the code so that it knows the size of the active  program window (ahk_class ProMainWin), so that it only works within the program ?
Or put some extra code in that will deactive the program window if the mouse leaves it ?

skwire:
I think I follow you.  Try this instead:


--- Code: Autohotkey ---RButton::{    Click    WinGet, myProcess, ProcessName, A    If ( myProcess = "prog32.exe" )    {        Click, Right    }}Return

-Huub-:
Hi Skwire, alomst there, it worked the only thing I see is that when you sript is active and the mouse cursor is is not in the prog32.exe program, the right mouse button acts like a left mouse button.
So if I click with the right button on a shortcut, or Start button it does the same as if I use the left mouse button, could it than be inactive like RButton::return ?

skwire:
Try this, please:


--- Code: Autohotkey ---RButton::{    MouseGetPos, , , myID,    WinGet, myProcess, ProcessName, ahk_id %myID%    If ( myProcess = "prog32.exe" )    {        Click, Right    }}Return

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version