Reputation: 107
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 ?
Upvotes: 2
Views: 487
Reputation: 1343
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)}");
}
}
}
Upvotes: 3
Reputation: 5683
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);
Upvotes: 1