Table of Contents

Class R3GlobalHook

Namespace
SharpHook.R3
Assembly
SharpHook.R3.dll

Represents a reactive R3 global keyboard and mouse hook.

public sealed class R3GlobalHook : BasicGlobalHookBase, IR3GlobalHook, IBasicGlobalHook, IDisposable
Inheritance
R3GlobalHook
Implements
Inherited Members

Constructors

R3GlobalHook(GlobalHookType, TimeProvider?, IGlobalHookProvider?, bool)

Initializes a new instance of R3GlobalHook.

public R3GlobalHook(GlobalHookType globalHookType = GlobalHookType.All, TimeProvider? defaultTimeProvider = null, IGlobalHookProvider? globalHookProvider = null, bool runAsyncOnBackgroundThread = false)

Parameters

globalHookType GlobalHookType

The global hook type.

defaultTimeProvider TimeProvider

The default time provider for observables, or null to use the default one as defined in R3.ObservableSystem.DefaultTimeProvider.

globalHookProvider IGlobalHookProvider

The underlying global hook provider, or null to use the default one.

runAsyncOnBackgroundThread bool

true if RunAsync() should run the hook on a background thread. Otherwise, false.

Properties

HookDisabled

Gets an observable which emits a value when the global hook is disabled.

public Observable<HookEventArgs> HookDisabled { get; }

Property Value

Observable<HookEventArgs>

An observable which emits a value when the global hook is disabled.

Remarks

The observable emits a value when the Stop() or Dispose() method is called.

HookEnabled

Gets an observable which emits a value when the global hook is enabled.

public Observable<HookEventArgs> HookEnabled { get; }

Property Value

Observable<HookEventArgs>

An observable which emits a value when the global hook is enabled.

Remarks

The observable emits a value when the Run() or RunAsync() method is called.

KeyPressed

Gets an observable which emits a value when a key is pressed.

public Observable<KeyboardHookEventArgs> KeyPressed { get; }

Property Value

Observable<KeyboardHookEventArgs>

An observable which emits a value when a key is pressed.

KeyReleased

Gets an observable which emits a value when a key is released.

public Observable<KeyboardHookEventArgs> KeyReleased { get; }

Property Value

Observable<KeyboardHookEventArgs>

An observable which emits a value when a key is released.

KeyTyped

Gets an observable which emits a value when a key is typed.

public Observable<KeyboardHookEventArgs> KeyTyped { get; }

Property Value

Observable<KeyboardHookEventArgs>

An observable which emits a value when a key is typed.

MouseClicked

Gets an observable which emits a value when a mouse button is clicked.

public Observable<MouseHookEventArgs> MouseClicked { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when a mouse button is clicked.

MouseDragged

Gets an observable which emits a value when the mouse cursor is dragged.

public Observable<MouseHookEventArgs> MouseDragged { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when the mouse cursor is dragged.

MouseMoved

Gets an observable which emits a value when the mouse cursor is moved.

public Observable<MouseHookEventArgs> MouseMoved { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when the mouse cursor is moved.

MousePressed

Gets an observable which emits a value when a mouse button is pressed.

public Observable<MouseHookEventArgs> MousePressed { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when a mouse button is pressed.

MouseReleased

Gets an observable which emits a value when a mouse button is released.

public Observable<MouseHookEventArgs> MouseReleased { get; }

Property Value

Observable<MouseHookEventArgs>

An observable which emits a value when a mouse button is released.

MouseWheel

Gets an observable which emits a value when the mouse wheel is scrolled.

public Observable<MouseWheelHookEventArgs> MouseWheel { get; }

Property Value

Observable<MouseWheelHookEventArgs>

An observable which emits a value when the mouse wheel is scrolled.

Methods

Dispose(bool)

Disposes of the global hook, stopping it if it is running.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if the method is called from the Dispose() method. Otherwise, false.

Exceptions

HookException

Stopping the hook has failed.

HandleHookEvent(ref UioHookEvent)

Handles the hook event.

protected override void HandleHookEvent(ref UioHookEvent e)

Parameters

e UioHookEvent

The event to handle.

See Also