[DllImport("user32.dll", EntryPoint = "keybd_event")] public static extern void keybd_event( byte bVk, byte bScan, int dwFlags, //这里是整数类型 0 为按下,2为释放 int dwExtraInfo //这里是整数类型 一般情况下设成为 0 ); //模拟按键shift+ctrl+x
public void ShowWriter() { keybd_event((byte)Keys.ShiftKey, 0, 0, 0); keybd_event((byte)Keys.ControlKey, 0, 0, 0); keybd_event((byte)Keys.X, 0, 0, 0); keybd_event((byte)Keys.ShiftKey, 0, 2, 0); keybd_event((byte)Keys.ControlKey, 0, 2, 0); keybd_event((byte)Keys.X, 0, 2, 0); }