![]() |
| | #1 |
| Registered User Join Date: Feb 2009
Posts: 22
| 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";
}
|
| vrkiller is offline | |
| | #2 |
| Registered User Join Date: Mar 2008
Posts: 2
| The proper way to use GetAsyncKeyState is to BitAND the return value with 0x8000. 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.
}
}
|
| chris95219 is offline | |
| | #3 |
| Registered User Join Date: Feb 2009
Posts: 22
| thx you, worked it ;D |
| vrkiller is offline | |
![]() |
| Tags |
| getasynckeystate(), noob, pressed, vrkiller |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GetAsyncKeyState Problem | kevinawad | C++ Programming | 1 | 11-07-2008 06:00 PM |
| Problems with cin and GetAsyncKeyState | KgNe | C++ Programming | 32 | 08-21-2008 10:00 AM |
| Infinite Loop with GetAsyncKeyState | guitarist809 | Windows Programming | 1 | 04-18-2008 12:09 PM |
| Problems with GetAsyncKeyState | blurrymadness | C++ Programming | 13 | 04-21-2007 06:13 PM |