C# hold key in a game application
I'm trying to make a C# application, which is going to control a game. That I'm trying to do is for example: Hold key A for 150ms, Hold left arrow for 500ms and so on. I was searching a lot and I found the following code. My program firstly target the game and then holding the keys. I'm holding the keys this way: Keyboard.HoldKey(Keys.Left); Thread.sleep(500); Keyboard.ReleaseKey(Keys.Left); Here is the Keyboard class: public class Keyboard { public Keyboard() { } [StructLayout(LayoutKind.Explicit, Size = 28)] public struct Input { [FieldOffset(0)] public uint type; [FieldOffset(4)] public