Simulate Alt + Tab
Dec 16, 2014 at 12:42am UTC
I'm trying to make a program that will simulate Alt + Tab, but I can't get it working. I've tried a bunch of stuff but nothing will work. Here's one of my attempts...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
void AltTab() {
INPUT ip;
INPUT ip2;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.wVk = VK_LMENU;
ip.ki.dwFlags = 0;
SendInput(1, &ip, sizeof (INPUT));
Sleep(100);
ip2.type = INPUT_KEYBOARD;
ip2.ki.wScan = 0;
ip2.ki.time = 0;
ip2.ki.dwExtraInfo = 0;
ip2.ki.wVk = VK_TAB;
ip2.ki.dwFlags = 0;
SendInput(1, &ip2, sizeof (INPUT));
ip.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof (INPUT));
ip2.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip2, sizeof (INPUT));
}
Dec 16, 2014 at 1:28am UTC
@Bingocat4
And what does the Alt+Tab combination do?.
Dec 16, 2014 at 1:39am UTC
Brings up the thing in the middle of the screen to switch between windows.
Dec 16, 2014 at 3:44am UTC
@Bingocat4
Thanks. I didn't know it was a windows programming thing. I only program in console mode.
Topic archived. No new replies allowed.