Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #define WINVER 0x0500
- int key[] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 };
- int main()
- {
- while (1) {
- Sleep(1);
- if(GetKeyState(key[1]) != 0) printf("%x\n", GetKeyState(key[1]));
- for (int i = 0; i < 10; i++) {
- if (GetKeyState(key[i]) & 0x8000) {
- std::cout << "Sending Key " << key[i] << " " << i << std::endl;
- INPUT ip;
- INPUT ip_keyup;
- INPUT ip_shift;
- INPUT ip_alt;
- ip.type = INPUT_KEYBOARD;
- ip.ki.wScan = 0;
- ip.ki.time = 0;
- ip.ki.dwExtraInfo = 0;
- ip.ki.wVk = key[i];
- ip.ki.dwFlags = 0;
- ip_keyup.type = INPUT_KEYBOARD;
- ip_keyup.ki.wScan = 0;
- ip_keyup.ki.time = 0;
- ip_keyup.ki.dwExtraInfo = 0;
- ip_keyup.ki.wVk = key[i];
- ip_keyup.ki.dwFlags = KEYEVENTF_KEYUP;
- ip_alt.type = INPUT_KEYBOARD;
- ip_alt.ki.wScan = 0;
- ip_alt.ki.time = 0;
- ip_alt.ki.dwExtraInfo = 0;
- ip_alt.ki.wVk = VK_MENU;
- ip_alt.ki.dwFlags = 0;
- ip_shift.type = INPUT_KEYBOARD;
- ip_shift.ki.wScan = 0;
- ip_shift.ki.time = 0;
- ip_shift.ki.dwExtraInfo = 0;
- ip_shift.ki.wVk = VK_SHIFT;
- ip_shift.ki.dwFlags = 0;
- INPUT keyInput4[4] = { 0 };
- INPUT keyInput3[3] = { 0 };
- if (GetKeyState(VK_SHIFT) & 0x8000) {
- std::cout << "With Shift" << std::endl;
- keyInput4[0] = ip;
- keyInput4[1] = ip_shift;
- keyInput4[2] = ip_keyup;
- keyInput4[3] = ip;
- if (GetKeyState(key[i]) & 0x8000) {
- SendInput(4, keyInput4, sizeof(INPUT));
- }
- } else if (GetKeyState(VK_MENU) & 0x8000) {
- std::cout << "With Alt" << std::endl;
- keyInput4[0] = ip;
- keyInput4[1] = ip_alt;
- keyInput4[2] = ip_keyup;
- keyInput4[3] = ip;
- if (GetKeyState(key[i]) & 0x8000) {
- SendInput(4, keyInput4, sizeof(INPUT));
- }
- } else {
- keyInput3[0] = ip;
- keyInput3[1] = ip_keyup;
- keyInput3[2] = ip;
- if (GetKeyState(key[i]) & 0x8000) {
- SendInput(3, keyInput3, sizeof(INPUT));
- }
- }
- Sleep(5);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement