- #include <Windows.h>
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int Key[300] = {0};
- while(0 == 0)
- {
- if (GetAsyncKeyState(0x01) != Key[0])
- {
- if (Key[0] == 0)
- {
- cout << "(Left Mouse)";
- Key[0] = -32768;
- }
- else if (Key[0] == -32768)
- {
- Key[0] = 0;
- }
- }
- else if (GetAsyncKeyState(0x02) != Key[1])
- {
- if (Key[1] == 0)
- {
- cout << "(Right Mouse)";
- Key[1] = -32768;
- }
- else if (Key[1] == -32768)
- {
- Key[1] = 0;
- }
- }
- else if (GetAsyncKeyState(0x03) != Key[2])
- {
- if (Key[2] == 0)
- {
- cout << "(Cancel)";
- Key[2] = -32768;
- }
- else if (Key[2] == -32768)
- {
- Key[2] = 0;
- }
- }
- else if (GetAsyncKeyState(0x04) != Key[3])
- {
- if (Key[3] == 0)
- {
- cout << "(Middle Mouse)";
- Key[3] = -32768;
- }
- else if (Key[3] == -32768)
- {
- Key[3] = 0;
- }
- }
- else if (GetAsyncKeyState(0x05) != Key[4])
- {
- if (Key[4] == 0)
- {
- cout << "(X1 Mouse)";
- Key[4] = -32768;
- }
- else if (Key[4] == -32768)
- {
- Key[4] = 0;
- }
- }
- else if (GetAsyncKeyState(0x06) != Key[5])
- {
- if (Key[5] == 0)
- {
- cout << "(X2 Mouse)";
- Key[5] = -32768;
- }
- else if (Key[5] == -32768)
- {
- Key[5] = 0;
- }
- }
- else if (GetAsyncKeyState(0x07) != Key[6])
- {
- if (Key[6] == 0)
- {
- cout << "(Undefined)";
- Key[6] = -32768;
- }
- else if (Key[6] == -32768)
- {
- Key[6] = 0;
- }
- }
- else if (GetAsyncKeyState(0x08) != Key[7])
- {
- if (Key[7] == 0)
- {
- cout << "(Backspace)";
- Key[7] = -32768;
- }
- else if (Key[7] == -32768)
- {
- Key[7] = 0;
- }
- }
- else if (GetAsyncKeyState(0x09) != Key[8])
- {
- if (Key[8] == 0)
- {
- cout << "(Tab)";
- Key[8] = -32768;
- }
- else if (Key[8] == -32768)
- {
- Key[8] = 0;
- }
- }
- else if (GetAsyncKeyState(0x0C) != Key[9])
- {
- if (Key[9] == 0)
- {
- cout << "(Clear Key)";
- Key[9] = -32768;
- }
- else if (Key[9] == -32768)
- {
- Key[9] = 0;
- }
- }
- else if (GetAsyncKeyState(0x0D) != Key[10])
- {
- if (Key[10] == 0)
- {
- cout << "(Enter)";
- Key[10] = -32768;
- }
- else if (Key[10] == -32768)
- {
- Key[10] = 0;
- }
- }
- else if (GetAsyncKeyState(0x10) != Key[11])
- {
- if (Key[11] == 0)
- {
- cout << "(Shift)";
- Key[11] = -32768;
- }
- else if (Key[11] == -32768)
- {
- Key[11] = 0;
- cout << "(Shift Released)";
- }
- }
- else if (GetAsyncKeyState(0x11) != Key[12])
- {
- if (Key[12] == 0)
- {
- cout << "(Control)";
- Key[12] = -32768;
- }
- else if (Key[12] == -32768)
- {
- Key[12] = 0;
- cout << "(Control Released)";
- }
- }
- else if (GetAsyncKeyState(0x12) != Key[13])
- {
- if (Key[13] == 0)
- {
- cout << "(Alt)";
- Key[13] = -32768;
- }
- else if (Key[13] == -32768)
- {
- Key[13] = 0;
- cout << "(Alt Released)";
- }
- }
- else if (GetAsyncKeyState(0x13) != Key[14])
- {
- if (Key[14] == 0)
- {
- cout << "(Pause)";
- Key[14] = -32768;
- }
- else if (Key[14] == -32768)
- {
- Key[14] = 0;
- }
- }
- else if (GetAsyncKeyState(0x14) != Key[15])
- {
- if (Key[15] == 0)
- {
- cout << "(Caps Lock)";
- Key[15] = -32768;
- }
- else if (Key[15] == -32768)
- {
- Key[15] = 0;
- }
- }
- else if (GetAsyncKeyState(0x1B) != Key[16])
- {
- if (Key[16] == 0)
- {
- cout << "(Escape)";
- Key[16] = -32768;
- }
- else if (Key[16] == -32768)
- {
- Key[16] = 0;
- }
- }
- else if (GetAsyncKeyState(0x20) != Key[17])
- {
- if (Key[17] == 0)
- {
- cout << " ";
- Key[17] = -32768;
- }
- else if (Key[17] == -32768)
- {
- Key[17] = 0;
- }
- }
- else if (GetAsyncKeyState(0x21) != Key[18])
- {
- if (Key[18] == 0)
- {
- cout << "(Page Up)";
- Key[18] = -32768;
- }
- else if (Key[18] == -32768)
- {
- Key[18] = 0;
- }
- }
- else if (GetAsyncKeyState(0x22) != Key[19])
- {
- if (Key[19] == 0)
- {
- cout << "(Page Down)";
- Key[19] = -32768;
- }
- else if (Key[19] == -32768)
- {
- Key[19] = 0;
- }
- }
- else if (GetAsyncKeyState(0x23) != Key[20])
- {
- if (Key[20] == 0)
- {
- cout << "(End)";
- Key[20] = -32768;
- }
- else if (Key[20] == -32768)
- {
- Key[20] = 0;
- }
- }
- else if (GetAsyncKeyState(0x24) != Key[21])
- {
- if (Key[21] == 0)
- {
- cout << "(Home)";
- Key[21] = -32768;
- }
- else if (Key[21] == -32768)
- {
- Key[21] = 0;
- }
- }
- else if (GetAsyncKeyState(0x25) != Key[22])
- {
- if (Key[22] == 0)
- {
- cout << "(Left Arrow)";
- Key[22] = -32768;
- }
- else if (Key[22] == -32768)
- {
- Key[22] = 0;
- }
- }
- else if (GetAsyncKeyState(0x26) != Key[23])
- {
- if (Key[23] == 0)
- {
- cout << "(Up Arrow)";
- Key[23] = -32768;
- }
- else if (Key[23] == -32768)
- {
- Key[23] = 0;
- }
- }
- else if (GetAsyncKeyState(0x27) != Key[24])
- {
- if (Key[24] == 0)
- {
- cout << "(Right Arrow)";
- Key[24] = -32768;
- }
- else if (Key[24] == -32768)
- {
- Key[24] = 0;
- }
- }
- else if (GetAsyncKeyState(0x28) != Key[25])
- {
- if (Key[25] == 0)
- {
- cout << "(Down Arrow)";
- Key[25] = -32768;
- }
- else if (Key[25] == -32768)
- {
- Key[25] = 0;
- }
- }
- else if (GetAsyncKeyState(0x29) != Key[26])
- {
- if (Key[26] == 0)
- {
- cout << "(Select)";
- Key[26] = -32768;
- }
- else if (Key[26] == -32768)
- {
- Key[26] = 0;
- }
- }
- else if (GetAsyncKeyState(0x2A) != Key[27])
- {
- if (Key[27] == 0)
- {
- cout << "(Print)";
- Key[27] = -32768;
- }
- else if (Key[27] == -32768)
- {
- Key[27] = 0;
- }
- }
- else if (GetAsyncKeyState(0x2B) != Key[28])
- {
- if (Key[28] == 0)
- {
- cout << "(Execute)";
- Key[28] = -32768;
- }
- else if (Key[28] == -32768)
- {
- Key[28] = 0;
- }
- }
- else if (GetAsyncKeyState(0x2C) != Key[29])
- {
- if (Key[29] == 0)
- {
- cout << "(Print Screen)";
- Key[29] = -32768;
- }
- else if (Key[29] == -32768)
- {
- Key[29] = 0;
- }
- }
- else if (GetAsyncKeyState(0x2D) != Key[30])
- {
- if (Key[30] == 0)
- {
- cout << "(Insert)";
- Key[30] = -32768;
- }
- else if (Key[30] == -32768)
- {
- Key[30] = 0;
- }
- }
- else if (GetAsyncKeyState(0x2E) != Key[31])
- {
- if (Key[31] == 0)
- {
- cout << "(Delete)";
- Key[31] = -32768;
- }
- else if (Key[31] == -32768)
- {
- Key[31] = 0;
- }
- }
- else if (GetAsyncKeyState(0x2F) != Key[32])
- {
- if (Key[32] == 0)
- {
- cout << "(Help)";
- Key[32] = -32768;
- }
- else if (Key[32] == -32768)
- {
- Key[32] = 0;
- }
- }
- else if (GetAsyncKeyState(0x30) != Key[33])
- {
- if (Key[33] == 0)
- {
- cout << "0";
- Key[33] = -32768;
- }
- else if (Key[33] == -32768)
- {
- Key[33] = 0;
- }
- }
- else if (GetAsyncKeyState(0x31) != Key[34])
- {
- if (Key[34] == 0)
- {
- cout << "1";
- Key[34] = -32768;
- }
- else if (Key[34] == -32768)
- {
- Key[34] = 0;
- }
- }
- else if (GetAsyncKeyState(0x32) != Key[35])
- {
- if (Key[35] == 0)
- {
- cout << "2";
- Key[35] = -32768;
- }
- else if (Key[35] == -32768)
- {
- Key[35] = 0;
- }
- }
- else if (GetAsyncKeyState(0x33) != Key[36])
- {
- if (Key[36] == 0)
- {
- cout << "3";
- Key[36] = -32768;
- }
- else if (Key[36] == -32768)
- {
- Key[36] = 0;
- }
- }
- else if (GetAsyncKeyState(0x34) != Key[37])
- {
- if (Key[37] == 0)
- {
- cout << "4";
- Key[37] = -32768;
- }
- else if (Key[37] == -32768)
- {
- Key[37] = 0;
- }
- }
- else if (GetAsyncKeyState(0x35) != Key[38])
- {
- if (Key[38] == 0)
- {
- cout << "5";
- Key[38] = -32768;
- }
- else if (Key[38] == -32768)
- {
- Key[38] = 0;
- }
- }
- else if (GetAsyncKeyState(0x36) != Key[39])
- {
- if (Key[39] == 0)
- {
- cout << "6";
- Key[39] = -32768;
- }
- else if (Key[39] == -32768)
- {
- Key[39] = 0;
- }
- }
- else if (GetAsyncKeyState(0x37) != Key[40])
- {
- if (Key[40] == 0)
- {
- cout << "7";
- Key[40] = -32768;
- }
- else if (Key[40] == -32768)
- {
- Key[40] = 0;
- }
- }
- else if (GetAsyncKeyState(0x38) != Key[41])
- {
- if (Key[41] == 0)
- {
- cout << "8";
- Key[41] = -32768;
- }
- else if (Key[41] == -32768)
- {
- Key[41] = 0;
- }
- }
- else if (GetAsyncKeyState(0x39) != Key[42])
- {
- if (Key[42] == 0)
- {
- cout << "9";
- Key[42] = -32768;
- }
- else if (Key[42] == -32768)
- {
- Key[42] = 0;
- }
- }
- else if (GetAsyncKeyState(0x41) != Key[43])
- {
- if (Key[43] == 0)
- {
- cout << "a";
- Key[43] = -32768;
- }
- else if (Key[43] == -32768)
- {
- Key[43] = 0;
- }
- }
- else if (GetAsyncKeyState(0x42) != Key[44])
- {
- if (Key[44] == 0)
- {
- cout << "b";
- Key[44] = -32768;
- }
- else if (Key[44] == -32768)
- {
- Key[44] = 0;
- }
- }
- else if (GetAsyncKeyState(0x43) != Key[45])
- {
- if (Key[45] == 0)
- {
- cout << "c";
- Key[45] = -32768;
- }
- else if (Key[45] == -32768)
- {
- Key[45] = 0;
- }
- }
- else if (GetAsyncKeyState(0x44) != Key[46])
- {
- if (Key[46] == 0)
- {
- cout << "d";
- Key[46] = -32768;
- }
- else if (Key[46] == -32768)
- {
- Key[46] = 0;
- }
- }
- else if (GetAsyncKeyState(0x45) != Key[47])
- {
- if (Key[47] == 0)
- {
- cout << "e";
- Key[47] = -32768;
- }
- else if (Key[47] == -32768)
- {
- Key[47] = 0;
- }
- }
- else if (GetAsyncKeyState(0x46) != Key[48])
- {
- if (Key[48] == 0)
- {
- cout << "f";
- Key[48] = -32768;
- }
- else if (Key[48] == -32768)
- {
- Key[48] = 0;
- }
- }
- else if (GetAsyncKeyState(0x47) != Key[49])
- {
- if (Key[49] == 0)
- {
- cout << "g";
- Key[49] = -32768;
- }
- else if (Key[49] == -32768)
- {
- Key[49] = 0;
- }
- }
- else if (GetAsyncKeyState(0x48) != Key[50])
- {
- if (Key[50] == 0)
- {
- cout << "h";
- Key[50] = -32768;
- }
- else if (Key[50] == -32768)
- {
- Key[50] = 0;
- }
- }
- else if (GetAsyncKeyState(0x49) != Key[51])
- {
- if (Key[51] == 0)
- {
- cout << "i";
- Key[51] = -32768;
- }
- else if (Key[51] == -32768)
- {
- Key[51] = 0;
- }
- }
- else if (GetAsyncKeyState(0x4a) != Key[52])
- {
- if (Key[52] == 0)
- {
- cout << "j";
- Key[52] = -32768;
- }
- else if (Key[52] == -32768)
- {
- Key[52] = 0;
- }
- }
- else if (GetAsyncKeyState(0x4b) != Key[53])
- {
- if (Key[53] == 0)
- {
- cout << "k";
- Key[53] = -32768;
- }
- else if (Key[53] == -32768)
- {
- Key[53] = 0;
- }
- }
- else if (GetAsyncKeyState(0x4c) != Key[54])
- {
- if (Key[54] == 0)
- {
- cout << "l";
- Key[54] = -32768;
- }
- else if (Key[54] == -32768)
- {
- Key[54] = 0;
- }
- }
- else if (GetAsyncKeyState(0x4d) != Key[55])
- {
- if (Key[55] == 0)
- {
- cout << "m";
- Key[55] = -32768;
- }
- else if (Key[55] == -32768)
- {
- Key[55] = 0;
- }
- }
- else if (GetAsyncKeyState(0x4e) != Key[56])
- {
- if (Key[56] == 0)
- {
- cout << "n";
- Key[56] = -32768;
- }
- else if (Key[56] == -32768)
- {
- Key[56] = 0;
- }
- }
- else if (GetAsyncKeyState(0x4f) != Key[57])
- {
- if (Key[57] == 0)
- {
- cout << "o";
- Key[57] = -32768;
- }
- else if (Key[57] == -32768)
- {
- Key[57] = 0;
- }
- }
- else if (GetAsyncKeyState(0x50) != Key[58])
- {
- if (Key[58] == 0)
- {
- cout << "p";
- Key[58] = -32768;
- }
- else if (Key[58] == -32768)
- {
- Key[58] = 0;
- }
- }
- else if (GetAsyncKeyState(0x51) != Key[59])
- {
- if (Key[59] == 0)
- {
- cout << "q";
- Key[59] = -32768;
- }
- else if (Key[59] == -32768)
- {
- Key[59] = 0;
- }
- }
- else if (GetAsyncKeyState(0x52) != Key[60])
- {
- if (Key[60] == 0)
- {
- cout << "r";
- Key[60] = -32768;
- }
- else if (Key[60] == -32768)
- {
- Key[60] = 0;
- }
- }
- else if (GetAsyncKeyState(0x53) != Key[61])
- {
- if (Key[61] == 0)
- {
- cout << "s";
- Key[61] = -32768;
- }
- else if (Key[61] == -32768)
- {
- Key[61] = 0;
- }
- }
- else if (GetAsyncKeyState(0x54) != Key[62])
- {
- if (Key[62] == 0)
- {
- cout << "t";
- Key[62] = -32768;
- }
- else if (Key[62] == -32768)
- {
- Key[62] = 0;
- }
- }
- else if (GetAsyncKeyState(0x55) != Key[63])
- {
- if (Key[63] == 0)
- {
- cout << "u";
- Key[63] = -32768;
- }
- else if (Key[63] == -32768)
- {
- Key[63] = 0;
- }
- }
- else if (GetAsyncKeyState(0x56) != Key[64])
- {
- if (Key[64] == 0)
- {
- cout << "v";
- Key[64] = -32768;
- }
- else if (Key[64] == -32768)
- {
- Key[64] = 0;
- }
- }
- else if (GetAsyncKeyState(0x57) != Key[65])
- {
- if (Key[65] == 0)
- {
- cout << "w";
- Key[65] = -32768;
- }
- else if (Key[65] == -32768)
- {
- Key[65] = 0;
- }
- }
- else if (GetAsyncKeyState(0x58) != Key[66])
- {
- if (Key[66] == 0)
- {
- cout << "x";
- Key[66] = -32768;
- }
- else if (Key[66] == -32768)
- {
- Key[66] = 0;
- }
- }
- else if (GetAsyncKeyState(0x59) != Key[67])
- {
- if (Key[67] == 0)
- {
- cout << "y";
- Key[67] = -32768;
- }
- else if (Key[67] == -32768)
- {
- Key[67] = 0;
- }
- }
- else if (GetAsyncKeyState(0x5A) != Key[68])
- {
- if (Key[68] == 0)
- {
- cout << "z";
- Key[68] = -32768;
- }
- else if (Key[68] == -32768)
- {
- Key[68] = 0;
- }
- }
- else if (GetAsyncKeyState(0x60) != Key[69])
- {
- if (Key[69] == 0)
- {
- cout << "0";
- Key[69] = -32768;
- }
- else if (Key[69] == -32768)
- {
- Key[69] = 0;
- }
- }
- else if (GetAsyncKeyState(0x61) != Key[70])
- {
- if (Key[70] == 0)
- {
- cout << "1";
- Key[70] = -32768;
- }
- else if (Key[70] == -32768)
- {
- Key[70] = 0;
- }
- }
- else if (GetAsyncKeyState(0x62) != Key[71])
- {
- if (Key[71] == 0)
- {
- cout << "2";
- Key[71] = -32768;
- }
- else if (Key[71] == -32768)
- {
- Key[71] = 0;
- }
- }
- else if (GetAsyncKeyState(0x63) != Key[72])
- {
- if (Key[72] == 0)
- {
- cout << "3";
- Key[72] = -32768;
- }
- else if (Key[72] == -32768)
- {
- Key[72] = 0;
- }
- }
- else if (GetAsyncKeyState(0x64) != Key[73])
- {
- if (Key[73] == 0)
- {
- cout << "4";
- Key[73] = -32768;
- }
- else if (Key[73] == -32768)
- {
- Key[73] = 0;
- }
- }
- else if (GetAsyncKeyState(0x65) != Key[74])
- {
- if (Key[74] == 0)
- {
- cout << "5";
- Key[74] = -32768;
- }
- else if (Key[74] == -32768)
- {
- Key[74] = 0;
- }
- }
- else if (GetAsyncKeyState(0x66) != Key[75])
- {
- if (Key[75] == 0)
- {
- cout << "6";
- Key[75] = -32768;
- }
- else if (Key[75] == -32768)
- {
- Key[75] = 0;
- }
- }
- else if (GetAsyncKeyState(0x67) != Key[76])
- {
- if (Key[76] == 0)
- {
- cout << "7";
- Key[76] = -32768;
- }
- else if (Key[76] == -32768)
- {
- Key[76] = 0;
- }
- }
- else if (GetAsyncKeyState(0x68) != Key[77])
- {
- if (Key[77] == 0)
- {
- cout << "8";
- Key[77] = -32768;
- }
- else if (Key[77] == -32768)
- {
- Key[77] = 0;
- }
- }
- else if (GetAsyncKeyState(0x69) != Key[78])
- {
- if (Key[78] == 0)
- {
- cout << "9";
- Key[78] = -32768;
- }
- else if (Key[78] == -32768)
- {
- Key[78] = 0;
- }
- }
- else if (GetAsyncKeyState(0x70) != Key[79])
- {
- if (Key[79] == 0)
- {
- cout << "(F1)";
- Key[79] = -32768;
- }
- else if (Key[79] == -32768)
- {
- Key[79] = 0;
- }
- }
- else if (GetAsyncKeyState(0x71) != Key[80])
- {
- if (Key[80] == 0)
- {
- cout << "(F2)";
- Key[80] = -32768;
- }
- else if (Key[80] == -32768)
- {
- Key[80] = 0;
- }
- }
- else if (GetAsyncKeyState(0x72) != Key[81])
- {
- if (Key[81] == 0)
- {
- cout << "(F3)";
- Key[81] = -32768;
- }
- else if (Key[81] == -32768)
- {
- Key[81] = 0;
- }
- }
- else if (GetAsyncKeyState(0x73) != Key[82])
- {
- if (Key[82] == 0)
- {
- cout << "(F4)";
- Key[82] = -32768;
- }
- else if (Key[82] == -32768)
- {
- Key[82] = 0;
- }
- }
- else if (GetAsyncKeyState(0x74) != Key[83])
- {
- if (Key[83] == 0)
- {
- cout << "(F5)";
- Key[83] = -32768;
- }
- else if (Key[83] == -32768)
- {
- Key[83] = 0;
- }
- }
- else if (GetAsyncKeyState(0x75) != Key[84])
- {
- if (Key[84] == 0)
- {
- cout << "(F6)";
- Key[84] = -32768;
- }
- else if (Key[84] == -32768)
- {
- Key[84] = 0;
- }
- }
- else if (GetAsyncKeyState(0x76) != Key[85])
- {
- if (Key[85] == 0)
- {
- cout << "(F7)";
- Key[85] = -32768;
- }
- else if (Key[85] == -32768)
- {
- Key[85] = 0;
- }
- }
- else if (GetAsyncKeyState(0x77) != Key[86])
- {
- if (Key[86] == 0)
- {
- cout << "(F8)";
- Key[86] = -32768;
- }
- else if (Key[86] == -32768)
- {
- Key[86] = 0;
- }
- }
- else if (GetAsyncKeyState(0x78) != Key[87])
- {
- if (Key[87] == 0)
- {
- cout << "(F9)";
- Key[87] = -32768;
- }
- else if (Key[87] == -32768)
- {
- Key[87] = 0;
- }
- }
- else if (GetAsyncKeyState(0x79) != Key[88])
- {
- if (Key[88] == 0)
- {
- cout << "(F10)";
- Key[88] = -32768;
- }
- else if (Key[88] == -32768)
- {
- Key[88] = 0;
- }
- }
- else if (GetAsyncKeyState(0x7A) != Key[89])
- {
- if (Key[89] == 0)
- {
- cout << "(F11)";
- Key[89] = -32768;
- }
- else if (Key[89] == -32768)
- {
- Key[89] = 0;
- }
- }
- else if (GetAsyncKeyState(0x7B) != Key[90])
- {
- if (Key[90] == 0)
- {
- cout << "(F12)";
- Key[90] = -32768;
- }
- else if (Key[90] == -32768)
- {
- Key[90] = 0;
- }
- }
- else if (GetAsyncKeyState(0x82) != Key[91])
- {
- if (Key[91] == 0)
- {
- cout << "(Figure this one out #1)";
- Key[91] = -32768;
- }
- else if (Key[91] == -32768)
- {
- Key[91] = 0;
- }
- }
- }
- }