inputsimulator
inputsimulator copied to clipboard
Throw Win32Exception with last error code when Sendinput fails
Throwing Win32Exception exception has an advantage that it won't swallow the error code and it will automatically get the user friendly error message for the error that happened.
See https://blogs.msdn.com/b/adam_nathan/archive/2003/04/25/56643.aspx for details.