获取本程序接收到的键盘消息

 1 #include 
 2 #include 
 3 using namespace std;
 4 
 5 int main()
 6 {
 7     while(true)
 8     {
 9         if(-32767 == GetAsyncKeyState(VK_SPACE))
10             cout<<" ";
11         else if(-32767 == GetAsyncKeyState('A'))
12             cout<<"A";
13         else if(-32767 == GetAsyncKeyState('B'))
14             cout<<"B";
15         else if(-32767 == GetAsyncKeyState('C'))
16             cout<<"C";
17         else if(-32767 == GetAsyncKeyState('D'))
18             cout<<"D";
19         else if(-32767 == GetAsyncKeyState('E'))
20             cout<<"E";
21     }
22     return 0;
23 }

 

转载于:https://www.cnblogs.com/Open-Source/p/10931860.html

你可能感兴趣的:(获取本程序接收到的键盘消息)