Windows input has thwarted all my attempts to attempt to even semi-understand it. I've read through the information about the different bits and how the least sign. bit of GetAsyncKeyState only works sometimes (which I suppose shouldn't be used at all since it is not reliable). If I use the function at all, it will work once, for one key, and then all input to that window doesn't register at all. I know I'm doing something wrong programmatically but I can't figure out what.
if (GetAsyncKeyState(VK_F10) >> 8 < 0 || GetAsyncKeyState(VK_F10) >> 1 < 0 || GetAsyncKeyState(VK_F10) < 0)
{
TerminalOn = !TerminalOn;
if (GetFocus() != hwnd)
SetFocus(hwnd);
ToSetWindow = true;
}
I've changed this actually a bunch of times only to produce the same result. Any ideas/advice? (and if that advice is "don't use GetAsyncKeyState()", i'd thank you, but I do need a form of keyboard input that does not rely on focus or the window being shown (as it is hidden when not active))
Also bear in mind that bitwise operators have low precedence; I cannot remember exactly, but I'm pretty sure that evaluates to:
if (GetAsyncKeyState(VK_F10) >> (8 < 0) || GetAsyncKeyState(VK_F10) >> (1 < 0) || GetAsyncKeyState(VK_F10) < 0){ ... }
Every so often, I forget, and run into a problem where a conditional evaluates differently if I don't put extra parentheses before doing a comparison.