Original Post
Hi ! For my game, the player can use the keyboard. I use Direct Input for the controls of keyboard and joystick. To know if the user press (let's say ESCAPE KEY), I do the following... if( KEYDOWN( DIK_ESCAPE )) { // Escape is down, do something... } to check if the high-bit is = 1. KEYDOWN is a macro define like.... #define KEYDOWN(key) (KeyboardState[key] & 0x80) My problem is that after doing something and going elsewhere in the process, the key is still pressed (bit 8 is still to 1) !!! So my patch is to clear by myself this bit. It works well if I wait some milliseconds. KeyboardState[DIK_ESCAPE] = 0; Sleep(50); Every sample on the web doesn't need to clear this bit !!! I suppose that it clears by itself when the key is up ! Can somebody can explain why I need my patch ? Thank.