RE: [GD-Windows] GetAsyncKeyState / DI
Brought to you by:
vexxed72
From: Wayne C. <wc...@re...> - 2002-11-06 17:16:40
|
> // 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. > > Isn't it just the same as what you did ? > > > if( Key[i].state&KEY_BEGIN ) > > Key[i].state ^= KEY_BEGIN; > > Or simply : > Key[i].state &= ~KEY_BEGIN; Unfortunately the remarks section inside the MSDN documentation go on to say: "Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon." So you can't really rely upon this bit being set correctly. Wayne -Virus scanned and cleared ok |