/// <summary>
 /// Presses a key (mouse or keyboard) inside a window or control. PostMessage alows async execution and returns immediately.
 /// </summary>
 /// <param name="windowHandle">The handle of a Window or Control.</param>
 /// <param name="key">The key.</param>
 /// <param name="state">The state of the given key.</param>
 /// <param name="usePostMessage">Determines whether to use the PostMessage API or not.</param>
 /// <returns>Returns true on success.</returns>
 public static bool PressKey(IntPtr windowHandle, Keys key, KeyStates state, bool usePostMessage = false)
 {
     return(usePostMessage
                             ? WindowInputHelper.PostMessage(windowHandle, key, state)
                             : WindowInputHelper.SendMessage(windowHandle, key, state));
 }
 /// <summary>
 /// Moves the mouse relative to the window. PostMessage alows async execution and returns immediately.
 /// </summary>
 /// <param name="windowHandle">The handle of a Window or Control.</param>
 /// <param name="x">The new x-coordinate of the mouse.</param>
 /// <param name="y">The new y-coordinate of the mouse.</param>
 /// <param name="usePostMessage">Determines whether to use the PostMessage API or not.</param>
 /// <returns>Returns true on success.</returns>
 public static bool MoveMouse(IntPtr windowHandle, int x, int y, bool usePostMessage = false)
 {
     return(usePostMessage
                             ? WindowInputHelper.PostMouseMoveMessage(windowHandle, x, y)
                             : WindowInputHelper.SendMouseMoveMessage(windowHandle, x, y));
 }