MouseHookPipe¶
Assembly:
MouseHookPipe
Namespace: Global¶
NativeMethods¶
Minimal Win32 interop surface used by MouseHookPipe for message pump and thread APIs.
Program¶
Entry point for the mouse hook publisher; initializes logging, coordinates the hook thread, and hosts self-healing timers.
Methods¶
GetIdleTime()¶
Computes the current user idle duration reported by Windows via GetLastInputInfo.
Returns: The span since the last user input event, or System.TimeSpan.Zero when unavailable.
HookCallback(int nCode, IntPtr wParam, IntPtr lParam)¶
Processes low-level mouse events, forwarding click notifications to the named pipe and chaining to the next hook.
Parameters
nCode— Hook code that indicates structure validity.wParam— Windows message identifier associated with the mouse event.lParam— Pointer to aMSLLHOOKSTRUCTdescribing the mouse event.
Returns: The result of Program.CallNextHookEx(System.IntPtr,System.Int32,System.IntPtr,System.IntPtr) to preserve hook chain semantics.
Main()¶
Configures logging, wires lifecycle handlers, starts the hook owner thread, and blocks the process lifetime.
Namespace: Program¶
HookThread¶
Owns the low-level mouse hook and Win32 message pump on a dedicated thread, allowing callers to post rehook/unhook commands.
Methods¶
DequeueCommandOrFallback(Collections.Concurrent.ConcurrentQueue param0, string param1)¶
Removes the installed hook when requested or during shutdown; safe to call repeatedly.
Dispose()¶
Stops the message pump, allowing the owner thread to exit and clean up the mouse hook on the correct thread.
HookThread(Program.LowLevelMouseProc proc, Action onHookId)¶
Creates a hook owner thread that installs the supplied callback and reports hook identifiers through onHookId.
Parameters
proc— Mouse hook callback to install.onHookId— Observer invoked whenever the hook identifier changes.
Install()¶
Installs the low-level mouse hook on the owner thread and publishes the hook identifier to observers.
PostRehook(string param0)¶
Requests that the owner thread re-install the mouse hook, debounced to avoid rapid detach/attach loops.
PostUnhook(string param0)¶
Requests that the owner thread uninstall the hook, used for power/lock transitions.
Start()¶
Starts the dedicated owner thread that installs the mouse hook and processes message pump work.
ThreadMain()¶
Thread entry point that installs the hook, handles owner-thread control messages, and pumps Windows messages.