Tony_Henrich
Tony_Henrich

Reputation: 44225

Need to disable mouse right click in Windows?

I am creating a system tray app which monitors mouse clicks in Windows. I want to disable the right mouse click. My app is based on this sample code.

In the HookCallback method, I tried to do this:

if ((MouseMessages)wParam == MouseMessages.WM_RBUTTONDOWN)
                    return (System.IntPtr)1;

thinking the mpuse event will be not be processed but the context menu of the right mouse click still shows up.

Upvotes: 1

Views: 1958

Answers (2)

Tony_Henrich
Tony_Henrich

Reputation: 44225

I used Mini-Input from www.mini-tools.com.

Upvotes: 0

Ashish
Ashish

Reputation: 8529

I think you have not handled WM_RBUTTONUP message, that's why the context menu showes up.

Just add this code snippet and check it works...

if ((MouseMessages)wParam == MouseMessages.WM_RBUTTONUP)                    
    return (System.IntPtr)1;

Upvotes: 1

Related Questions