GetAsyncKeyState(...)



  • Hi!
    Ich habe eine Frage zu GetAsyncKeyState.
    Ich prüfe in unregelmässigen Abständen, ob die linke Maustaste und die strg Taste zusammen gedrückt wurden.

    if(GetAsyncKeyState(0x01) && GetAsyncKeyState(0x11))
    {
             [...]
    

    Wenn ich nun allerdings zuerst die strg Taste drücke und danach erst die linke Maustaste drücke, geben beide Funktionen true zurück. Ich will aber, dass der Codeabschnitt nur ausgeführt wird, wenn beide Tasten gedrückt sind. Die MSDN sagt, dass man am Rückgabewert erkennen kann, ob die Taste entweder seit dem letzten Funktionsaufruf von GetAsyncKeyState gedrückt wurde, oder ob sie in diesem Moment gedrückt wird:

    If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. 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.

    Kann mir jemand sagen, was "the most / the least significant bit" ist und wie ich die Funktion so benutze, dass ich weiss, ob beide Tasten momentan gedrückt sind?


Anmelden zum Antworten