Table of Contents

Interface IGlobalHookProvider

Namespace
SharpHook.Providers
Assembly
SharpHook.dll

Represents a provider of low-level global hook functionality.

public interface IGlobalHookProvider

Properties

KeyTypedEnabled

Gets or sets the value which indicates whether events of type KeyTyped are enabled. The default value is true.

bool KeyTypedEnabled { get; set; }

Property Value

bool

true if events of type KeyTyped are enabled. Otherwise, false.

Methods

Run()

Runs the global hook and blocks the thread until it's stopped.

UioHookResult Run()

Returns

UioHookResult

The result of the operation.

RunKeyboard()

Runs the global hook only for keyboard events and blocks the thread until it's stopped.

UioHookResult RunKeyboard()

Returns

UioHookResult

The result of the operation.

RunMouse()

Runs the global hook only for mouse events and blocks the thread until it's stopped.

UioHookResult RunMouse()

Returns

UioHookResult

The result of the operation.

SetDispatchProc(DispatchProc?, nint)

Sets the hook callback function.

void SetDispatchProc(DispatchProc? dispatchProc, nint userData)

Parameters

dispatchProc DispatchProc

The function to call when an event is raised, or null to unset the function.

userData nint

Custom data to pass to the callback. Should not be used to pass pointers to objects, and Zero should usually be passed.

Stop()

Stops the global hook.

UioHookResult Stop()

Returns

UioHookResult

The result of the operation.