internal static extern UInt32 SendInput(UInt32 nInputs, Input[] pInputs, Int32 cbSize);
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 = NativeMethods.GetTickCount(); if (NativeMethods.SendInput((uint)input.Length, input, Marshal.SizeOf(input[0])) < input.Length) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }