1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <iostream>
#include <conio.h>
#include <windows.h>
#define _VK_A 0x50
#define _VK_B 0x50
#define _VK_C 0x50
#define _VK_D 0x50
#define _VK_E 0x50
#define _VK_F 0x50
#define _VK_G 0x50
#define _VK_H 0x50
#define _VK_I 0x50
#define _VK_J 0x50
#define _VK_K 0x50
#define _VK_L 0x50
#define _VK_M 0x50
#define _VK_N 0x50
#define _VK_O 0x50
#define _VK_P 0x50
#define _VK_Q 0x50
#define _VK_R 0x50
#define _VK_S 0x50
#define _VK_T 0x50
#define _VK_U 0x50
#define _VK_V 0x50
#define _VK_W 0x50
#define _VK_X 0x50
#define _VK_Y 0x50
#define _VK_Z 0x50
using namespace std;
int main()
{
int key;
while (true)
{
if (GetAsyncKeyState(_VK_A), GetAsyncKeyState(_VK_B), GetAsyncKeyState(_VK_C), GetAsyncKeyState(_VK_D), GetAsyncKeyState(_VK_E), GetAsyncKeyState(_VK_F), GetAsyncKeyState(_VK_G), GetAsyncKeyState(_VK_H), GetAsyncKeyState(_VK_I), GetAsyncKeyState(_VK_J), GetAsyncKeyState(_VK_K), GetAsyncKeyState(_VK_L), GetAsyncKeyState(_VK_M), GetAsyncKeyState(_VK_N), GetAsyncKeyState(_VK_O), GetAsyncKeyState(_VK_P), GetAsyncKeyState(_VK_Q), GetAsyncKeyState(_VK_R), GetAsyncKeyState(_VK_S), GetAsyncKeyState(_VK_T), GetAsyncKeyState(_VK_U), GetAsyncKeyState(_VK_V), GetAsyncKeyState(_VK_W), GetAsyncKeyState(_VK_X), GetAsyncKeyState(_VK_Y), GetAsyncKeyState(_VK_Z))
{
cout << "you are pressing a button" << endl;
break;
}
else
{
cout << "you are not pressing any buttons" << endl;
continue;
}
return 0;
}
}
|