Donc quand on veut utiliser une fonction de l' API on se documente bien avant sur msdn par exemple
The GetKeyState function retrieves the status of the specified virtual
key. The status specifies whether the key is up, down, or toggled (on,
off-alternating each time the key is pressed).
SHORT GetKeyState(
int nVirtKey
);
Donc on voit que la fonction retourne un SHORT et qu'elle nous informe que l'état de la touche, enfoncée, relâchée, ou activée si la touche concernée et une touche du genre Maj ou Verr Num etc...
Return Value
The return value specifies the status of the specified virtual key, as
follows:
- If the high-order bit is 1, the key is down; otherwise, it is up.
- If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK
key, is toggled if it is turned on. The key is off and untoggled if the
low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will
be on when the key is toggled, and off when the key is untoggled.
Donc le bit de poids fort est à 1 si la touche est pressée
Sinon, elle est relâchée
Comment tester le bit de poids fort ???
un SHORT c'est codé sur 16 bits sur un système 32 bits ( les plus courants pour l'instant ) donc
1000 0000 0000 0000
Pour récupérer le bit de poids fort on fait
GetKeyState(VK_LEFT) & 0x8000
Et voilà, tu testes s'il est à 1 ou à 0
ULARGE_INTEGERJokyQi=QI("Joky"