I use this code in VS 2013 in win8 for simulate press Alt+Tab, but nothing happen. i test it in win 7 and VS 2012 it's work fine.
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
private const byte VK_MENU = 0x12;
private const byte VK_TAB = 0x09;
private const int KEYEVENTF_EXTENDEDKEY = 0x01;
private const int KEYEVENTF_KEYUP = 0x02;
keybd_event(VK_MENU, 0xb8, 0, 0); //Alt Press
keybd_event(VK_TAB, 0x8f, 0, 0); // Tab Press
System.Threading.Thread.Sleep(70);
keybd_event(VK_TAB, 0x8f, KEYEVENTF_KEYUP, 0); // Tab Release
keybd_event(VK_MENU, 0xb8, KEYEVENTF_KEYUP, 0); // Alt Releas
How can i solve this problem in win8? thanks
may be its too late to answer but an answered question may help other in future. Try to send key combination using SendKeys it may work for you.
SendKeys.Send("%+{TAB}");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With