语法:
SendKeys.Send(string keys)
SendKeys.SendWait(string keys);
1\向活动窗口发送字符串:
SendKeys.SendWait("我是c#"); //发送 :我是c#
2\模拟发送+、^、%、~及圆括号 ( ) ,要将它放在大括号 ({}) 当中。
SendKeys.SendWait("{+}"); //发送+
3\模拟发送组合键
key | 代码 |
Ctrl | ^ |
shift | + |
Ait | % |
SenKeys.SendWait("^c"); //发送Ctrl+C
SenKeys.SendWait("^{F4}"); //发送Ctrl+F4
SendKeys.SendWait("{a 5}"); //模拟5次按下字母a