GetAsyncKeyState
-
Hallo erstmal,
Ich hab ein Problem mit der Funktion GetAsyncKeyState: Wenn ich Zahlen oder Buchstaben abfragen will, bekomme ich immer 0 zurück geliefert.
Mein Code:
if (GetAsyncKeyState(VK_CONTROL) != 0 && GetAsyncKeyState(34) != 0) {//CTRL + 4 cout<<"ausgeloest!"; }VK_CONTROL funktioniert auch wunderbar, aber die 4 nicht. Den Wert für die Taste 4 hab ich von HIER. Das selbe passiert auch bei den anderen Zahlen und Buchstaben, ich kann nur Tasten wie VK_CONTROL, VK_TAB etc. benutzen.
Woran liegt das? Was muss ich benutzen, damit es funktioniert? Jetzt schonmal danke für die Hilfe
-
msdn schrieb:
If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. However, you should not rely on this last behavior; for more information, see the Remarks.
Sprich: Du musst zusehen das du nur das most significant bit beachtest.
So macht wine das:
http://www.codase.com/search/call?name=GetAsyncKeyState
-
Klappt wunderbar, danke.