I'd like to send a sequence of keypresses (to make up a word) to the window of a DirectX application followed by a pause before sending the ENTER
key.
I'm able to send individual keypresses with the InputManager library, but I'm unsure of how to implement "waits" in between certain key sequences with this keyboard hook.
ie: Send the message "Hello", wait for 250ms followed by the ENTER
key.
SendKeys and SendWait will not work for what I'm doing, as they will not send keystrokes to the DirectX application.
Here is some pseudo-code explaining what I'm trying to accomplish:
using InputManager;
namespace MyProject
{
public partial class form1: Form
{
private void helloButton_Click(object sender, EventArgs e)
{
Keyboard.KeyPress(Keys.H);
Keyboard.KeyPress(Keys.E);
Keyboard.KeyPress(Keys.L);
Keyboard.KeyPress(Keys.L);
Keyboard.KeyPress(Keys.O);
// (Wait 250ms)
Keyboard.KeyPress(Keys.Enter);
}
}
}
You can use Thread.Sleep(250);
. This will pause the currently working thread for x
amount of milliseconds.
Note that you will need to include System.Threading
in your using statements.