public static void InjectKey(bool keyUp, ScanCode code) { tagKEYBDINPUT input = new tagKEYBDINPUT() { wScan = code }; if (keyUp) { input.dwFlags = KeyEventFlags.KEYEVENTF_KEYUP; } InjectKeyboardInput(ref input, 1); }
private static extern bool InjectKeyboardInput(ref tagKEYBDINPUT input, uint count);