public static void SendInput(ScanCode scanCode, VirtualKeys virtualKey, KeyEventFlag keyEvent) { var inputs = new[] { CreateKeyboardInput(scanCode, virtualKey, keyEvent), }; Win32.SendInput(1, inputs, Input.Size); }
public static extern void keybd_event(byte bVk, byte bScan, KeyEventFlag dwFlags, int dwExtraInfo);
//键盘操作 public void keybd(byte _bVk, KeyEventFlag _dwFlags) { keybd_event(_bVk, 0, _dwFlags, 0); }
public static Input CreateKeyboardInput(ScanCode scanCode, VirtualKeys virtualKey, KeyEventFlag keyEvent) => new Input() { type = InputType.KEYBOARD, U = new InputUnion { ki = new KeyboardInput() { time = 0, wScan = scanCode, wVk = virtualKey, dwFlags = keyEvent, } } };
public static extern void keybd_event(Byte bVk, Byte bScan, KeyEventFlag dwFlags, Int32 dwExtraInfo);
//键盘操作 public void Keybd(Byte _bVk, KeyEventFlag _dwFlags) { Keybd_event(_bVk, 0, _dwFlags, 0); }
private void virtual_KeyboardEvent(byte key, KeyEventFlag _dwFlags) { keybd_event(key, 0, _dwFlags, 0); }
private static extern void keybd_event( byte bVk, byte bScan, KeyEventFlag dwFlags, IntPtr dwExtraInfo);