private void SendKeyUp(short key) { Input[] input = new Input[1]; input[0].type = INPUT.KEYBOARD; input[0].ki.wVk = key; input[0].ki.dwFlags = KeyboardConstaint.KEYEVENTF_KEYUP; input[0].ki.time = Win32.GetTickCount(); if (Win32.SendInput((uint)input.Length, input, Marshal.SizeOf(input[0])) < input.Length) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }
internal static extern UInt32 SendInput(UInt32 nInputs, Input[] pInputs, Int32 cbSize);
[DllImport("user32.dll")]public static extern UInt32 SendInput(UInt32 nInputs, Input[] pInputs, int cbSize);