Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define WINVER 0x0500
- #include <windows.h>
- void SendKbInp(const char *str, const DWORD delayT = 0, const DWORD delayT2 = 0, bool pressEnter = true)
- {
- INPUT ip;
- Sleep(delayT);
- ip.type = INPUT_KEYBOARD;
- ip.ki.wScan = 0;
- ip.ki.time = 0;
- ip.ki.dwExtraInfo = 0;
- for (int i = 0;;)
- {
- char c;
- if (!str[i]){
- if (!pressEnter)
- return;
- c = VK_RETURN;
- pressEnter = false;
- }
- else
- c = str[i++];
- ip.ki.wVk = VkKeyScanA(c);
- ip.ki.dwFlags = false;
- SendInput(1, &ip, sizeof(INPUT));
- ip.ki.dwFlags = KEYEVENTF_KEYUP;
- SendInput(1, &ip, sizeof(INPUT));
- Sleep(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement