So i am building an interface using WPF, which will launch a WPF application on different machines in the same network using PsExec commands.
Example:
private static void _remotelyOpenEXE(string psEpath, string ipv4LocalAdd, string userName, string passWord, string path)
{
ProcessStartInfo psi = new ProcessStartInfo(psEpath, string.Format("\\\\{0} -i 1 -d -u {1} -p {2} {3}", ipv4LocalAdd, userName, passWord, path));
psi.UseShellExecute = false;
psi.CreateNoWindow = false;
Process.Start(psi);
}
Now that's the easy part, what i want to do is interact with each application loaded, and control each specific WPF app in each machine specifically, for example clicking buttons, retrieve information such as a list which is present in that GUI.
I can easily monitor process using this sample code:
Process[] proc = Process.GetProcesses(GetMachineNameFromIPAddress(ipv4LocalAdd));
foreach (var p in proc)
{
//can list each process now
}
private static string GetMachineNameFromIPAddress(string ipv4LocalAdd)
{
string machineName = string.Empty;
try
{
IPHostEntry hostEntry = Dns.GetHostEntry(ipv4LocalAdd);
machineName = hostEntry.HostName;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return string.Empty;
}
return machineName;
}
Now, how do i go about controlling each application?