Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <stdlib.h>
- int main(){
- while (true){
- if (GetAsyncKeyState(0x51) & 0x8000){ //if pressed Q
- SHORT key;
- UINT mappedKey;
- INPUT input { 0 };
- key = VkKeyScan('e');
- mappedKey = MapVirtualKey(LOBYTE(key), 0);
- input.type = INPUT_KEYBOARD;
- input.ki.dwFlags = KEYEVENTF_SCANCODE;
- input.ki.wScan = mappedKey;
- SendInput(1, &input, sizeof(input)); // key down
- Sleep(500);
- input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP; //key up
- SendInput(1, &input, sizeof(input));
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement