Thomas Perez Thomas Perez - 5 months ago 24x Question

How to to fill out another program's pop up fields programmatically in C#?

I have a C++ program that is launched using cmd. After being launched, he show off a pop up where the user has to write his login/password.

I want to launch this program with another program (wrote in C#), I know how to do that with


So my question is: ho can I fill the login/password's fields in my C# program ?


@DmitriyZapevalov was right. Here is some usefull links that helped me:


You have to use Windows API through Interop:

  1. Find popup's window handle (HWND)
  2. Find children fields handles
  3. Setup your text in fields by handles (SendMessage(WM_SETTEXT))

You can find fields and windows by names or IDs.

Use Spy++ to investigate popup window layout.