0

Im trynna make my own AutoClicker, and it has keyboard events. But when calling Cin after pressing the keys that activate the other functions of the program (Numpad 0 2 3) and having to use cin it automatically has 0 2 3 in it, i tried with cin.clear and it didn't make any difference. the part of the code that has problems

if (GetKeyState(0x61) & 0x80) {
            kbe.getKey(0x61);
            std::cout << "Set Delay: ";
            std::cin >> ms;

Other function that has no problem but still stores the key pressed in the previous function

if (GetKeyState(0x60) & 0x80) {
        kbe.getKey(0x60);
        GetCursorPos(&pt);
        x = pt.x;
        y = pt.y;
        std::cout << "x = " << x << " y = " << y;
        std::cout << "\|CursorPos Saved" << std::endl;
    }
Ian P.
  • 1
  • 3
    cin.clear() clears the error flags. You want cin.ignore() but you need to pass the right parameters. Havea look at https://stackoverflow.com/questions/25020129/cin-ignorenumeric-limitsstreamsizemax-n – Jerry Jeremiah Apr 01 '20 at 04:42
  • Does this answer your question? [cin.ignore(numeric\_limits::max(), '\n')](https://stackoverflow.com/questions/25020129/cin-ignorenumeric-limitsstreamsizemax-n) – Azeem Apr 01 '20 at 05:49

0 Answers0