I'm trying to simulate a CTRL + V keypress (and release) by using the INPUT
struct in windows.h, but I can only get it to work in simple programs such as notepad, whereas in the Steam client it doesn't actually write to it:
INPUT ip[4];
ip[0].type = INPUT_KEYBOARD;
ip[0].ki.wScan = 0;
ip[0].ki.dwFlags = 0;
ip[0].ki.wVk = VK_CONTROL;
ip[0].ki.time = 0;
ip[0].ki.dwExtraInfo = 0;
ip[1].type = INPUT_KEYBOARD;
ip[1].ki.wScan = 0;
ip[1].ki.dwFlags = 0;
ip[1].ki.wVk = 0x56;
ip[1].ki.time = 0;
ip[1].ki.dwExtraInfo = 0;
ip[2].type = INPUT_KEYBOARD;
ip[2].ki.wScan = 0;
ip[2].ki.dwFlags = KEYEVENTF_KEYUP;
ip[2].ki.wVk = VK_CONTROL;
ip[2].ki.time = 0;
ip[2].ki.dwExtraInfo = 0;
ip[3].type = INPUT_KEYBOARD;
ip[3].ki.wScan = 0;
ip[3].ki.dwFlags = KEYEVENTF_KEYUP;
ip[3].ki.wVk = 0x56;
ip[3].ki.time = 0;
ip[3].ki.dwExtraInfo = 0;
SendInput((sizeof(ip)/sizeof(INPUT)), ip, sizeof(INPUT));
What am I doing / thinking wrong? Full code: https://pastebin.com/CxCfeJar