public void SendInputWithAPI(string txt, BreakToken token) { INPUT[] Inputs = createInputArray(txt); foreach (var item in Inputs) { if (token.shouldBreak) { return; } Thread.Sleep(rng.Next(50, 150)); KeyboardHook.allowNext += 1; SendInput((uint)1, new INPUT[] { item }, INPUT.Size); } }
public void PressExtendedKey(ScanCodeShort key, int iter, BreakToken token) { var input = new INPUT(); input.type = 1; input.U.ki.wScan = key; input.U.ki.dwFlags = KEYEVENTF.EXTENDEDKEY | KEYEVENTF.SCANCODE; for (int i = 0; i < iter; i++) { if (token.shouldBreak) { return; } KeyboardHook.allowNext += 1; SendInput((uint)1, new INPUT[] { input }, INPUT.Size); Thread.Sleep(250); } }