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.
More Related Contents:
- How do I get console output in C++ with a Windows program?
- Win32 programming hiding console window
- What is the Best Practice for Combating the Console Closing Issue?
- How do I clear the console in BOTH Windows and Linux using C++
- How can I cin and cout some unicode text?
- How to use QueryPerformanceCounter?
- Getting started with OpenCV 2.4 and MinGW on Windows 7
- Requesting administrator privileges at run time
- C++ high precision time measurement in Windows
- Windows 7 timing functions – How to use GetSystemTimeAdjustment correctly?
- C++ How to detect Windows 10
- When and how should I use exception handling?
- When including header files, is the path case sensitive?
- C++ Windows – How to get process path from its PID
- How to solve Memory Fragmentation
- Detect Windows or Linux in C, C++ [duplicate]
- How to target Windows XP in Microsoft Visual Studio C++ [duplicate]
- Linking different libraries for Debug and Release builds in Cmake on windows?
- Refreshing the auto complete (IntelliSense) database in Visual Studio
- ReleaseSemaphore does not release the semaphore
- Is “std::cout” usable in Android-ndk
- cannot convert parameter 1 from ‘char’ to ‘LPCWSTR’
- Sorry, unimplemented: 64 bit mode not compiled in
- Differences between running an executable with Visual Studio debugger vs without debugger
- What is the maximum memory available to a C++ application on 32-bit Windows?
- How to get the starting/base address of a process in C++?
- DoEvents equivalent for C++?
- Possible problems with NOMINMAX on Visual C++
- Getting The Size of a C++ Function
- How can I find the size of all files located inside a folder?