tags:

views:

157

answers:

2

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.

+1  A: 

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;
Ashish
Most mouse activities happen on the mouse up, not mouse down. Try clicking a button slowly sometime. The biggest exception is when you want to drag.
Mark Ransom
A: 

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

Tony_Henrich