GetAsyncKeyState() jak zrobić

0

Przeczytałem na stronce coś takiego:

If the function fails (if the current thread does not have the input focus), the function returns 0. If the &H8000 bit of the return value is set, the key has been pressed at least once since the last time the thread called GetAsyncKeyState. If the &H1 bit of the return value is set, the key is currently pressed down.

Zakodziłem coś takiego:

if(!(GetAsyncKeyState('A') & 0x8000) && (GetAsyncKeyState('A') & 0x01))
{			
	MessageBox(0, "działa", "" , MB_OK);
}

Mój kod rozumiem tak: jeżeli (klawisz A nie był wciśnięty wcześniej i i jest naciśnięty teraz) to zrób {}

Co jest źle ??

0

Cos mi sie obilo o uszy, ze juz nie nalezy polegac na LSB zwracanej wartosci, ale to nie jest pewne. Wypisuj sobie na ekranie w jakiejs nieskonczonej petli ten bit i zobacz czy sie zmienia w zaleznosci od klawisza, u mnie na BCB 5 PE zawsze jest zero.

1 użytkowników online, w tym zalogowanych: 0, gości: 1