Table of Contents

Class EventSimulationExtensions

Namespace
SharpHook
Assembly
SharpHook.dll

Contains extension methods for IEventSimulator and IEventSimulationSequenceBuilder.

public static class EventSimulationExtensions
Inheritance
EventSimulationExtensions
Inherited Members

Methods

AddKeyStroke(IEventSimulationSequenceBuilder, params KeyCode[])

Adds a sequecne of key press and release events which represent a single key stroke to the sequence of events to simulate.

public static IEventSimulationSequenceBuilder AddKeyStroke(this IEventSimulationSequenceBuilder builder, params KeyCode[] keyCodes)

Parameters

builder IEventSimulationSequenceBuilder
keyCodes KeyCode[]

The codes of the keys to press and release.

Returns

IEventSimulationSequenceBuilder

The builder.

Remarks

As an example, if the method is called with the following parameters:

builder.AddKeyStroke(KeyCode.VcLeftControl, KeyCode.VcC);

then this will be equivalent to calling the following method sequence:

builder
    .AddKeyPress(KeyCode.VcLeftControl)
    .AddKeyPress(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcLeftControl);

which means that this method will add pressing Left Control, then pressing C, then releasing C, then releasing Left Control.

AddKeyStroke(IEventSimulationSequenceBuilder, IEnumerable<KeyCode>)

Adds a sequence of key press and release events which represent a single key stroke to the sequence of events to simulate.

public static IEventSimulationSequenceBuilder AddKeyStroke(this IEventSimulationSequenceBuilder builder, IEnumerable<KeyCode> keyCodes)

Parameters

builder IEventSimulationSequenceBuilder
keyCodes IEnumerable<KeyCode>

The codes of the keys to press and release.

Returns

IEventSimulationSequenceBuilder

The builder.

Remarks

As an example, if the method is called with the following parameters:

builder.AddKeyStroke([KeyCode.VcLeftControl, KeyCode.VcC]);

then this will be equivalent to calling the following method sequence:

builder
    .AddKeyPress(KeyCode.VcLeftControl)
    .AddKeyPress(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcLeftControl);

which means that this method will add pressing Left Control, then pressing C, then releasing C, then releasing Left Control.

SimulateKeyStroke(IEventSimulator, params KeyCode[])

Simulates a sequence of key press and release events which represent a single key stroke.

public static UioHookResult SimulateKeyStroke(this IEventSimulator simulator, params KeyCode[] keyCodes)

Parameters

simulator IEventSimulator
keyCodes KeyCode[]

The codes of the keys to press and release.

Returns

UioHookResult

The result of the operation.

Remarks

As an example, if the method is called with the following parameters:

simulator.SimulateKeyStroke(KeyCode.VcLeftControl, KeyCode.VcC);

then this will be equivalent to calling the following method sequence:

simulator.Sequence()
    .AddKeyPress(KeyCode.VcLeftControl)
    .AddKeyPress(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcLeftControl)
    .Simulate();

which means that this method will simualte pressing Left Control, then pressing C, then releasing C, then releasing Left Control.

SimulateKeyStroke(IEventSimulator, IEnumerable<KeyCode>)

Simulates a sequence of key press and release events which represent a single key stroke.

public static UioHookResult SimulateKeyStroke(this IEventSimulator simulator, IEnumerable<KeyCode> keyCodes)

Parameters

simulator IEventSimulator
keyCodes IEnumerable<KeyCode>

The codes of the keys to press and release.

Returns

UioHookResult

The result of the operation.

Remarks

As an example, if the method is called with the following parameters:

simulator.SimulateKeyStroke([KeyCode.VcLeftControl, KeyCode.VcC]);

then this will be equivalent to calling the following method sequence:

simulator.Sequence()
    .AddKeyPress(KeyCode.VcLeftControl)
    .AddKeyPress(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcC)
    .AddKeyRelease(KeyCode.VcLeftControl)
    .Simulate();

which means that this method will simualte pressing Left Control, then pressing C, then releasing C, then releasing Left Control.