Reputation: 44225
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
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