How to run/invoke a WPF application (.exe) from a Windows Forms ? I know it can be done like shown below:
Process.Start(@"C:\ABC\WPF.exe");
But I want to send few parameters to the WPF Applications from the winform application. How to do it ?
Refer to complete code from here
You can pass arguments from your winform app like
Process.Start(new ProcessStartInfo(@"C:\\repos\\WpfApp.exe", "Args from WinForms"));
and receive in WPF app like
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
if (e.Args.Length > 0)
{
MessageBox.Show($"You have passed:{e.Args.Length} arguments," +
$" value are {string.Join( ",",e.Args)}");
}
}
}
You can use the same method with a few parameters. So in your case
var procStart = System.Diagnostics.Process.Start(@"C:\ABC\WPF.exe", params);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.