C# - Control another application's windows using Thoughtworks White

user197967 picture user197967 · Dec 2, 2010 · Viewed 9.1k times · Source

I'm creating a C# program and I need to control another application. I found this example, but it doesn't really work for me (or at least I can't make it work).
1) The application is already running (so I can't use Application application = Application.Launch("foo.exe");
2) It has a textbox and I need to read what's written in it.
3) Then I want to press one of its buttons (This can be done with that: Button button = window.Get<Button>("save"); button.Click();

I also searched Google, but I didn't find anything working.
Can you help me? Thanks in advance.

Answer

unholysampler picture unholysampler · Dec 2, 2010

The documentation doesn't mention it, but Application.Attach() allows you to access a program that is already running. From there, I would expect everything would work as documented.