diff --git a/src/simulation/keyboardSim.cpp b/src/simulation/keyboardSim.cpp index 87757fc..0d7064c 100644 --- a/src/simulation/keyboardSim.cpp +++ b/src/simulation/keyboardSim.cpp @@ -6,7 +6,8 @@ void pressKey(WORD key) input.type = INPUT_KEYBOARD; input.ki.wVk = key; SendInput(1, &input, sizeof(INPUT)); - + // Wait + Sleep(PRESS_INTERVAL); // Release the key input.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, &input, sizeof(INPUT)); @@ -20,6 +21,8 @@ void pressKeyCombo(std::vector keys) inputs[i].type = INPUT_KEYBOARD; inputs[i].ki.wVk = keys[i]; } + // Wait + Sleep(PRESS_INTERVAL); for (size_t i = 0; i < keys.size(); i++) { inputs[i + keys.size()].type = INPUT_KEYBOARD; diff --git a/src/simulation/keyboardSim.hpp b/src/simulation/keyboardSim.hpp index b5d1a1c..a14ce47 100644 --- a/src/simulation/keyboardSim.hpp +++ b/src/simulation/keyboardSim.hpp @@ -13,6 +13,9 @@ #include #include +// How long, in milliseconds, to wait between pressing and releasing a key +#define PRESS_INTERVAL 10 + void pressKey(WORD key); void pressKeyCombo(std::vector keys); void keyUp(WORD key);