📜  cpp 仅在控制台中获取击键 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.880000             🧑  作者: Mango

代码示例1
HWND hwnd = GetConsoleWindow();


if (GetForegroundWindow() == hwnd){
    if((GetKeyState(VK_SPACE) & 0x8000) != 0)){
      // DO YOUR STUFF HERE
    }
}