I am trying to simulate a user pressing a key, holding it for some specific time interval, and then releasing it. I have tried to implement this using SendKeys.Send(), but I cannot figure out how to control the duration of how long the key is pressed.
I don't want to just keep sending the same key over and over; I want a single key-down and a single key-up event.
For example, I have code like this:
//when i press this button, will sent keyboard key "A", i want to hold it until i release private void start_btn_Click(object sender, EventArgs e) { testSent(); } //how should i hold it for a timer??? private void testSent() { SendKeys.Send("A"); }