I want to create a windows form type application in C # that opens an installation assistant .exe and automatically press the Next> buttons. Next > Finish (To give an example)
I already have the test button created and I have the code to open the .exe through: System.Diagnostics.Process.Start (@ "E: \ ..... .exe);
also create a function for the application to go forward and I'm passing the "Enter" key several times to give the button "next" of the application but it does not work, if someone could help me I would appreciate it, aki I leave my cod until now.
// THIS IS THE BUTTON CODE
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"E:\programas pcs\winrar-x64-411es.exe");
Thread.Sleep(1000);
Funciones.ActivateApp("winrar-x64-411es.exe");
Thread.Sleep(2000);
SendKeys.SendWait("{ENTER}");
Thread.Sleep(2000);
SendKeys.Send("{ENTER}");
Thread.Sleep(2000);
}
//FUNCION ACTIVATEAPP
public static void ActivateApp(string processName)
{
Process[] p = Process.GetProcessesByName(processName);
if (p.Count() > 0)
SetForegroundWindow(p[0].MainWindowHandle);
}