This is probably one of the strangest things I've encountered so far in C ++:
while(counter != stop_value)
{
ip.ki.wVk = VK_RETURN;
ip.ki.dwFlags = 0;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = VK_RETURN;
ip.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
if (s == 2) counter++;
else counter--;
cout << counter;
Sleep(i);
}
Whenever I comment on βPart Aβ, it works correctly; the program sleeps for iseconds, depending on user input. However, as soon as I add an easy way to start the return key, it forces me to turn off the entire computer (AKA, the screen turns completely black for iseconds). I tried searching on the Internet, but I can not do anything about it.
. INPUT . s , ( ) 2 3. , 0, ( stop-value). , sleep , "" i . , s 3, ( ) , -, . , .
, ... , , ( ), , :
- :
counter = 0; stop_value = 21; s = 2; i = 1000; - , :
counter = 20; stop_value = 0; s = 3; i = 1000;
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx