public static void SendShiftKeyUp(IntPtr windowHandle) { var virtualKey = VK_SHIFT; var scanCode = GetScanCode(virtualKey); var keyParameter = new KeyParameter(1, scanCode, false, false, true, true); NativeMethods.PostMessage(windowHandle, (uint)KeyboardCommand.KeyUp, new UIntPtr(virtualKey), keyParameter.ToLParam()); }
public static void SendKeyDown(IntPtr windowHandle, byte virtualKey) { var scanCode = GetScanCode(virtualKey); var keyParameter = new KeyParameter(1, scanCode, false, false, false, false); NativeMethods.PostMessage(windowHandle, (uint)KeyboardCommand.KeyDown, new UIntPtr(virtualKey), keyParameter.ToLParam()); }