Keyboard buffer - problem solved

Nobody replied to my query about emptying the keyboard buffer, but I solved it anyway.

Before launching an external program using shell_execute in Windows, do this:

 SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);
 SDL_EventState(SDL_KEYUP, SDL_IGNORE);

Which ignores key events (and the keyboard buffer will never fill up this way), and when returned from the shell_execute, do this:

 SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
 SDL_EventState(SDL_KEYUP, SDL_ENABLE);

Cheers,

Jeremy.

Nobody replied to my query about emptying the keyboard buffer, but I solved it anyway.

Before launching an external program using shell_execute in Windows, do this:

 SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);
 SDL_EventState(SDL_KEYUP, SDL_IGNORE);

Which ignores key events (and the keyboard buffer will never fill up this way), and when returned from the shell_execute, do this:

 SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
 SDL_EventState(SDL_KEYUP, SDL_ENABLE);

Glad to see you figured it out! :slight_smile:

Cheers,
-Sam Lantinga, Software Engineer, Blizzard Entertainment