GetKeyState() vs. GetAsyncKeyState() vs. getch()?
问题 What's the difference between getting a key press with: GetKeyState() GetAsyncKeyState() getch() ? When should I use one over the other? 回答1: GetKeyState() and GetAsyncKeyState() are Windows specific APIs, while getch() works on other non-Windows-specific C compilers. GetKeyState() gets the key status returned from the thread's message queue . The status does not reflect the interrupt-level state associated with the hardware. GetAsyncKeyState() specifies whether the key was pressed since the