我希望在发送ENTER
密钥之前向DirectX应用程序的窗口发送一系列按键(以构成一个单词),然后暂停。
我可以使用InputManager库发送单独的按键,但我不确定如何实施"等待"在这个键盘钩子的某些键序列之间。
ie:发送消息" Hello",等待250ms后跟ENTER
密钥。
SendKeys和SendWait不适用于我正在做的事情,因为他们不会向DirectX应用程序发送击键。
这是一些伪代码,解释了我想要实现的目标:
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);
}
}
}