Class EventSimulator
A keyboard and mouse event simulator which posts events to the OS.
Implements
Inherited Members
Namespace: SharpHook
Assembly: SharpHook.dll
Syntax
public class EventSimulator : IEventSimulator
Methods
| Improve this Doc View SourceSimulateKeyPress(KeyCode)
Simulates pressing a key.
Declaration
public UioHookResult SimulateKeyPress(KeyCode keyCode)
Parameters
Type | Name | Description |
---|---|---|
KeyCode | keyCode | The code of the key to press. |
Returns
Type | Description |
---|---|
UioHookResult | The result of the operation. |
SimulateKeyRelease(KeyCode)
Simulates releasing a key.
Declaration
public UioHookResult SimulateKeyRelease(KeyCode keyCode)
Parameters
Type | Name | Description |
---|---|---|
KeyCode | keyCode | The code of the key to release. |
Returns
Type | Description |
---|---|
UioHookResult | The result of the operation. |
SimulateMouseMovement(Int16, Int16)
Simulates moving a mouse pointer.
Declaration
public UioHookResult SimulateMouseMovement(short x, short y)
Parameters
Type | Name | Description |
---|---|---|
Int16 | x | The target X-coordinate of the mouse pointer. |
Int16 | y | The target Y-coordinate of the mouse pointer. |
Returns
Type | Description |
---|---|
UioHookResult | The result of the operation. |
SimulateMousePress(Int16, Int16, MouseButton)
Simulates pressing a mouse button at the specified coordinates.
Declaration
public UioHookResult SimulateMousePress(short x, short y, MouseButton button)
Parameters
Type | Name | Description |
---|---|---|
Int16 | x | The target X-coordinate of the mouse pointer. |
Int16 | y | The target Y-coordinate of the mouse pointer. |
MouseButton | button | The mouse button to press. |
Returns
Type | Description |
---|---|
UioHookResult | The result of the operation. |
SimulateMouseRelease(Int16, Int16, MouseButton)
Simulates releasing a mouse button at the specified coordinates.
Declaration
public UioHookResult SimulateMouseRelease(short x, short y, MouseButton button)
Parameters
Type | Name | Description |
---|---|---|
Int16 | x | The target X-coordinate of the mouse pointer. |
Int16 | y | The target Y-coordinate of the mouse pointer. |
MouseButton | button | The mouse button to release. |
Returns
Type | Description |
---|---|
UioHookResult | The result of the operation. |
SimulateMouseWheel(Int16, Int16, UInt16, Int16)
Simulates scrolling the mouse wheel at the specified coordinates.
Declaration
public UioHookResult SimulateMouseWheel(short x, short y, ushort amount, short rotation)
Parameters
Type | Name | Description |
---|---|---|
Int16 | x | The target X-coordinate of the mouse pointer. |
Int16 | y | The target Y-coordinate of the mouse pointer. |
UInt16 | amount | The scrolling amount. |
Int16 | rotation | The wheel rotation. |
Returns
Type | Description |
---|---|
UioHookResult | The result of the operation. |
Remarks
A positive rotation
value indicates that the wheel will be rotated down and a negative value
indicates that the wheel will be rotated up.
Mouse wheel simulation is a little inconsistent across platforms, and not documented. View the source code of libuiohook for more details.