模拟键盘按键
实现
[DllImport("user32.dll")]
private static extern void keybd_event(int bVk, byte bScan, int dwFlags, int dwExtraInfo);
使用
// 按键按下
keybd_event((int)Keys.ControlKey, 0, 0, 0);
keybd_event((int)Keys.V, 0, 0, 0);
// 按键抬起
keybd_event((int)Keys.V, 0, 2, 0);
keybd_event((int)Keys.ControlKey, 0, 2, 0);