Reputation: 495
I am trying to automate some tasks and was wondering if a Windows Form C# .NET 4 app can target a textbox in an external application and paste text into it?
If not what would be a good solution if any?
Upvotes: 1
Views: 388
Reputation: 4768
You can, but you will need to use the FindWindow* and SendMessage Windows API calls
http://www.pinvoke.net/default.aspx/user32.findwindow
I have used this for a project so that we could collect a serial number from a program and send them all back to our office rather than needing the user to copy/paste it.
after using the FindWindow
to find the Field you are looking for, then you can use SendMessage
with a messageType of WM_GETTEXT
to Get the text and to Set the text WM_SETTEXT
Upvotes: 1