c# - How to store and resend keyboard input for UI automation? -


I have a winforms application where I need to capture keyboard input and store it in a script. The script can be re-run with IronPython again to automate the application. Taking my present on this is listening to the KeyPress event and resending the pressed letters with SendKeys. To handle input with the modifier (alt, ctrl) I hear the keydown event but I do not know how the keys pressed in the script are represented. This is what I would like to do:

  Public Zero Text Box / Keyword (key events) {script.AddStatement (string.format ("SendKeys.Send ('{0}')", ?? ??))); }  

Do I have to manually create a string from KeyEventArgs that understands SendKeys?
Eg shift + A, shift + B gets sendKeys Send ("+ (AB)"). Details from

Is there any other way? Maybe store KeyEventArgs.KeyData and create a new KeyEventArgs instance and send it somehow?

The answer to this question was to stop using SendKeys and instead using p / invoke of keybd_event There were time-related problems and other unexpected behavior of SendKeys.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -