If you want to emulate the behaviour of ALT+TAB key combination just like if
you're pressing and holding the keys, you can use PInvoke calling the
keybd_event() API, instead of using the SendKeys class. The API provides
more possibilities to send keystrokes and emulate keystroke behaviour.
Here is an example for your situation:
[DllImport("user32")]
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;
private void button1_Click(object sender, System.EventArgs e)
{
keybd_event(VK_MENU,0,0,0);
keybd_event(VK_TAB,0,0,0);
System.Threading.Thread.Sleep(1000);
keybd_event(VK_TAB,0,0,0);
System.Threading.Thread.Sleep(1000);
keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
}
Hope it helps.
-- Ricky Lee
==================================================
^o^ "When all doors are closed, God will open a Windows" ^o^
==================================================
"Chris Mason" <te******@gmail.com> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...
I have an application that runs full screen on a system and I would like
to be able to (at times) switch another program using an ALT-TAB like
interface. However the system only has a touchscreen display so doing
this from a keyboard is not an option. Is there any way I can instantiate the
built in ALT-TAB window or is there any way I can generate the ALT-TAB
event/message progammatically.
Thanks for any help.
Chris