C# Класс MouseKeyboardActivityMonitor.BaseHookListener

Base class used to implement mouse or keybord hook listeners. It provides base methods to subscribe and unsubscribe to hooks. Common processing, error handling and cleanup logic.
Наследование: IDisposable
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
CallNextHook int

Открытые методы

Метод Описание
Dispose ( ) : void

Release delegates, unsubscribes from hooks.

Replace ( MouseKeyboardActivityMonitor.WinApi.Hooker hooker ) : void

Enables you to switch from application hooks to global hooks and vice versa on the fly without unsubscribing from events. Component remains enabled or disabled state after this call as it was before.

Start ( ) : void

Subscribes to the hook and starts firing events.

Stop ( ) : void

Unsubscribes from the hook and stops firing events.

Защищенные методы

Метод Описание
BaseHookListener ( MouseKeyboardActivityMonitor.WinApi.Hooker hooker ) : System

Base constructor of BaseHookListener

Hooks are not active after instantiation. You need to use either BaseHookListener.Enabled property or call BaseHookListener.Start method.

Dispose ( bool isDisposing ) : void

Method to be used from Dispose and finalizer. Override this method to release subclass sepcific references.

GetHookId ( ) : int

Override to deliver correct id to be used for HookNativeMethods.SetWindowsHookEx call.

HookCallback ( int nCode, Int32 wParam, IntPtr lParam ) : int

A callback function which will be called every time a keyboard or mouse activity detected. WinApi.HookCallback

ProcessCallback ( int wParam, IntPtr lParam ) : bool

Override this method to modify logic of firing events.

Приватные методы

Метод Описание
CallNextHook ( int nCode, int wParam, IntPtr lParam ) : int

Описание методов

BaseHookListener() защищенный Метод

Base constructor of BaseHookListener
Hooks are not active after instantiation. You need to use either BaseHookListener.Enabled property or call BaseHookListener.Start method.
protected BaseHookListener ( MouseKeyboardActivityMonitor.WinApi.Hooker hooker ) : System
hooker MouseKeyboardActivityMonitor.WinApi.Hooker Depending on this parameter the listener hooks either application or global keyboard events.
Результат System

Dispose() публичный Метод

Release delegates, unsubscribes from hooks.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Method to be used from Dispose and finalizer. Override this method to release subclass sepcific references.
protected Dispose ( bool isDisposing ) : void
isDisposing bool
Результат void

GetHookId() защищенный абстрактный Метод

Override to deliver correct id to be used for HookNativeMethods.SetWindowsHookEx call.
protected abstract GetHookId ( ) : int
Результат int

HookCallback() защищенный Метод

A callback function which will be called every time a keyboard or mouse activity detected. WinApi.HookCallback
protected HookCallback ( int nCode, Int32 wParam, IntPtr lParam ) : int
nCode int
wParam System.Int32
lParam System.IntPtr
Результат int

ProcessCallback() защищенный абстрактный Метод

Override this method to modify logic of firing events.
protected abstract ProcessCallback ( int wParam, IntPtr lParam ) : bool
wParam int
lParam System.IntPtr
Результат bool

Replace() публичный Метод

Enables you to switch from application hooks to global hooks and vice versa on the fly without unsubscribing from events. Component remains enabled or disabled state after this call as it was before.
public Replace ( MouseKeyboardActivityMonitor.WinApi.Hooker hooker ) : void
hooker MouseKeyboardActivityMonitor.WinApi.Hooker An AppHooker or GlobalHooker object.
Результат void

Start() публичный Метод

Subscribes to the hook and starts firing events.
public Start ( ) : void
Результат void

Stop() публичный Метод

Unsubscribes from the hook and stops firing events.
public Stop ( ) : void
Результат void