Interface IGlobalHook
- Namespace
- SharpHook
- Assembly
- SharpHook.dll
Represents a global keyboard and mouse hook.
public interface IGlobalHook : IDisposable
- Inherited Members
Properties
IsDisposed
Gets the value which indicates whether the global hook is disposed.
bool IsDisposed { get; }
Property Value
Remarks
A disposed global hook cannot be started again.
- See Also
IsRunning
Gets the value which indicates whether the global hook is running.
bool IsRunning { get; }
Property Value
- See Also
Methods
Run()
Runs the global hook on the current thread, blocking it. The hook can be destroyed by calling the Dispose() method.
void Run()
Exceptions
- HookException
Starting the global hook has failed.
- InvalidOperationException
The global hook is already running.
- ObjectDisposedException
The global hook has been disposed.
- See Also
RunAsync()
Runs the global hook without blocking the current thread. The hook can be destroyed by calling the Dispose() method.
Task RunAsync()
Returns
Remarks
Since the underlying native API for running a global hook is blocking, the only way to run it without blocking the current thread is to run it on a separate thread.
Exceptions
- HookException
Starting the global hook has failed.
- InvalidOperationException
The global hook is already running.
- ObjectDisposedException
The global hook has been disposed.
- See Also
Events
HookDisabled
An event which is raised when the global hook is disabled.
event EventHandler<HookEventArgs> HookDisabled
Event Type
Remarks
This event is raised when the Dispose() method is called.
- See Also
HookEnabled
An event which is raised when the global hook is enabled.
event EventHandler<HookEventArgs> HookEnabled
Event Type
Remarks
This event is raised when the Run() or RunAsync() method is called.
- See Also
KeyPressed
An event which is raised when a key is pressed.
event EventHandler<KeyboardHookEventArgs> KeyPressed
Event Type
- See Also
KeyReleased
An event which is raised when a key is released.
event EventHandler<KeyboardHookEventArgs> KeyReleased
Event Type
- See Also
KeyTyped
An event which is raised when a key is typed.
event EventHandler<KeyboardHookEventArgs> KeyTyped
Event Type
- See Also
MouseClicked
An event which is raised when a mouse button is clicked.
event EventHandler<MouseHookEventArgs> MouseClicked
Event Type
- See Also
MouseDragged
An event which is raised when the mouse cursor is dragged.
event EventHandler<MouseHookEventArgs> MouseDragged
Event Type
- See Also
MouseMoved
An event which is raised when the mouse cursor is moved.
event EventHandler<MouseHookEventArgs> MouseMoved
Event Type
- See Also
MousePressed
An event which is raised when a mouse button is pressed.
event EventHandler<MouseHookEventArgs> MousePressed
Event Type
- See Also
MouseReleased
An event which is raised when a mouse button is released.
event EventHandler<MouseHookEventArgs> MouseReleased
Event Type
- See Also
MouseWheel
An event which is raised when the mouse wheel is scrolled.
event EventHandler<MouseWheelHookEventArgs> MouseWheel
Event Type
- See Also