C# Class 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.
Inheritance: IDisposable
Afficher le fichier Open project: katopz/oskz-vcsharp

Private Properties

Свойство Type Description
CallNextHook int

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
CallNextHook ( int nCode, int wParam, IntPtr lParam ) : int

Method Details

BaseHookListener() protected méthode

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.
Résultat System

Dispose() public méthode

Release delegates, unsubscribes from hooks.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Method to be used from Dispose and finalizer. Override this method to release subclass sepcific references.
protected Dispose ( bool isDisposing ) : void
isDisposing bool
Résultat void

GetHookId() protected abstract méthode

Override to deliver correct id to be used for HookNativeMethods.SetWindowsHookEx call.
protected abstract GetHookId ( ) : int
Résultat int

HookCallback() protected méthode

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
Résultat int

ProcessCallback() protected abstract méthode

Override this method to modify logic of firing events.
protected abstract ProcessCallback ( int wParam, IntPtr lParam ) : bool
wParam int
lParam System.IntPtr
Résultat bool

Replace() public méthode

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.
Résultat void

Start() public méthode

Subscribes to the hook and starts firing events.
public Start ( ) : void
Résultat void

Stop() public méthode

Unsubscribes from the hook and stops firing events.
public Stop ( ) : void
Résultat void