C++ console keyboard events

Use ReadConsoleInput() API. Watch for events of kind KEY_EVENT. This won’t work for all keydown events (Ctrl-key, shift-key, Pause-key cannot be read), but most can be read.

Use GetNumberOfConsoleInputEvents to avoid blocking.

Leave a Comment