yeah, you can suppress mouse input events at the system level in a Windows environment using C#. This is typically achieved by creating a low-level mouse hook using the Windows API (specifically, the SetWindowsHookExSetWindowsHookEx
function). By doing so, you can intercept and suppress mouse events, such as a right mouse button down event, before they reach other applications or the desktop.
Here’s how you can achieve this:
- Create a Low-Level Mouse Hook: You can use
SetWindowsHookEx
to set a hook for low-level mouse events.
- Handle the Mouse Event: In the hook procedure, you can check for the specific mouse event you want to suppress (e.g.,
WM_RBUTTONDOWN
).
- Suppress the Event: If the event matches, you can return a non-zero value to suppress it, preventing it from being processed further.
Example CodeExample Code
Here's a simple example in C#:
using System;
using System.Diagnostics;using System.Diagnostics;
using System.Runtime.InteropServices;using System.Runtime.InteropServices;
using System.Windows.Forms;using System.Windows.Forms;
classclass Program
{{
private private staticstatic IntPtr hookId = IntPtr.Zero; IntPtr hookId = IntPtr.Zero;
private private staticstatic LowLevelMouseProc proc = HookCallback; LowLevelMouseProc proc = HookCallback;
public delegate IntPtr LowLevelMouseProc(int nCode public delegate IntPtr LowLevelMouseProc(int nCode,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, IntPtr wParam IntPtr wParam,,,,,,,,,,,,,,,, IntPtr lParam); IntPtr lParam);
[ [DllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImport(("""""""""""""""""""""user32.dll", CharSet = CharSet.Auto CharSet = CharSet.Auto, SetLastError = true)] SetLastError = true)]
privateprivate staticstatic extern IntPtr SetWindowsHookEx(int idHook(int idHook, LowLevelMouseProc lpfn LowLevelMouseProc lpfn, IntPtr hMod IntPtr hMod, uint dwThreadId); uint dwThreadId);
[ [DllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImport((""""""""""""""""user32.dll",, CharSet = CharSet.Auto CharSet = CharSet.Auto, SetLastError = true)] SetLastError = true)]
[ [return: : MarshalAs(UnmanagedType.Bool)](UnmanagedType.Bool)]
privateprivate static extern bool UnhookWindowsHookEx(IntPtr hhk);(IntPtr hhk);
[ [DllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImport((""""""user32.dll"",, CharSet = CharSet.Auto CharSet = CharSet.Auto, SetLastError = true)] SetLastError = true)]
privateprivate staticstatic extern IntPtr CallNextHookEx(IntPtr hhk(IntPtr hhk, int nCode int nCode, IntPtr wParam IntPtr wParam, IntPtr lParam); IntPtr lParam);
[ [DllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImportDllImport((""kernel32.dll", CharSet = CharSet.Auto CharSet = CharSet.Auto, SetLastError = true)] SetLastError = true)]
privateprivate static extern IntPtr GetModuleHandle(string lpModuleName);(string lpModuleName);
privateprivate const int WH__MOUSE__LL = = 14;;
privateprivate const int WM__RBUTTONDOWN = = 0x0204;;
staticstatic void Main(string[] args)(string[] args)
{ {
hookId = SetHook(proc); hookId = SetHook(proc);
Application.Run(); // Keeps the application running to listen Application.Run(); // Keeps the application running to listen for events events
UnhookWindowsHookEx(hookId); UnhookWindowsHookEx(hookId);
} }
private static IntPtr SetHook(LowLevelMouseProc proc)(LowLevelMouseProc proc)
{ {
using ( using (Process curProcess = curProcess = Process.GetCurrentProcess()).GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule) using (ProcessModule curModule = curProcess.MainModule)
{ {
returnreturn SetWindowsHookEx(WH_MOUSE_LL SetWindowsHookEx(WH_MOUSE_LL, proc proc, GetModuleHandle(curModule.ModuleName) GetModuleHandle(curModule.ModuleName), 0););
} }
} }
private static IntPtr HookCallback(int nCode(int nCode, IntPtr wParam IntPtr wParam, IntPtr lParam) IntPtr lParam)
{ {
ifif (nCode >= (nCode >= 0 && wParam == (IntPtr)WM_RBUTTONDOWN) && wParam == (IntPtr)WM_RBUTTONDOWN)
{ {
// Suppress the right mouse button down event // Suppress the right mouse button down event
returnreturn (IntPtr) (IntPtr)1;;
} }
returnreturn CallNextHookEx(hookId CallNextHookEx(hookId, nCode nCode, wParam wParam, lParam); lParam);
} }
}}