wpf - How to press Alt+Tab programmatically in C# in win 8 -
i use code in vs 2013 in win8 simulate press alt+tab, nothing happen. test in win 7 , 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 solve problem in win8? thanks
may late answer answered question may other in future. try send key combination using sendkeys may work you.
sendkeys.send("%+{tab}");
Comments
Post a Comment