I'm having problems with GetKeyWait. This allows you to check for keys non-blocking. However, when it tells me a key is pressed (KEYREP_KEYEVENT returned), the keycode is not set, just left at zero. This is not what the docs say.
take a look at this code snippet:
unsigned int k;
int changed = 0;
k = 0;
v = GetKeyWait(KEYWAIT_HALTOFF_TIMEROFF, 0, 1, &k); // nonblocking
if (v == KEYREP_KEYEVENT)
// !!! this never happens despite KEYEVENT signal
changed = keyhandler(k);
changed = idlehandler();
What happens is that i'm told a key is pressed, but `k' is never set! I'm wondering if there's another call i should make here to actually retrieve the key. note GetKey(&k) is no good because it waits again for another key.
Either i've made a silly mistake or this call is broken. Does anyone know how to inspect the keybuffer another way?
any help most appreciated. thanks,
Edited by Hugh, 15 February 2009 - 06:30 PM.