hello, when you press a key you can use the
GetAsyncKeyState();
function, but how do i do if i wan't to get the key you havé pressed
Code:if (Getapressedkey(vk_shift)) // code dosent work. { cout << "you have pressed on shift"; }
hello, when you press a key you can use the
GetAsyncKeyState();
function, but how do i do if i wan't to get the key you havé pressed
Code:if (Getapressedkey(vk_shift)) // code dosent work. { cout << "you have pressed on shift"; }
The proper way to use GetAsyncKeyState is to BitAND the return value with 0x8000.
You can also get a list of key states by calling GetKeyboardState.Code:if (GetAsyncKeyState(VK_SHIFT) & 0x8000) { // The key is currently down }
Code:unsigned char KeyStates[256]; GetKeyboardState(KeyStates); for (int i = 0; i < 256; i++) { if (KeyStates[i] & 0x8000) { // The keyboard key that 'i' represents is currently held down. } }
thx you, worked it ;D