public class KeySim
{
[DllImport("user32.dll")]
private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
public static void Press(string keys)
{
Press(keys.Split('+')
.Select(s => (Keys)Enum.Parse(typeof(Keys), s))
.ToList());
}
public static void Press(List<Keys> keys)
{
keys.ForEach(k => keybd_event((byte)k, 0, 0, 0));
Thread.Sleep(1000);
keys.ForEach(k => keybd_event((byte)k, 0, 2, 0));
}
}
KeySim.Press("LMenu+A");
KeySim.Press(new List<Keys> { Keys.LMenu, Keys.A });