Click to See Complete Forum and Search --> : synthesize alt tab


gamer150
January 16th, 2008, 09:18 PM
Is there a way to synthesize alt+tab? I think is has something to do with SendInput().

Plasmator
January 17th, 2008, 12:07 AM
Either call SendInput (if targeting an NT+ system), or call the "legacy" keybd_event function.

gamer150
January 17th, 2008, 06:08 AM
I got this, but i'm wondering if there's an easier way. (not that this doesn't work)


KEYBDINPUT k1 = {VK_MENU, 0, 0, 0, 0};
KEYBDINPUT k2 = {VK_ESCAPE, 0,0,0, 0};
KEYBDINPUT k3 = {VK_ESCAPE, 0,KEYEVENTF_KEYUP,0, 0};
KEYBDINPUT k4 = {VK_MENU, 0,KEYEVENTF_KEYUP,0, 0};
INPUT in1 = {INPUT_KEYBOARD};
in1.ki = k1;
INPUT in2 = {INPUT_KEYBOARD};
in2.ki = k2;
INPUT in3 = {INPUT_KEYBOARD};
in3.ki = k3;
INPUT in4 = {INPUT_KEYBOARD};
in4.ki = k4;
SendInput(1, &in1, sizeof(INPUT));
SendInput(1, &in2, sizeof(INPUT));
SendInput(1, &in3, sizeof(INPUT));
SendInput(1, &in4, sizeof(INPUT));