如何从Windows窗体运行/调用WPF应用程序(.exe(?我知道它可以像下面这样完成:
Process.Start(@"C:ABCWPF.exe");
但是我想从 winform 应用程序向 WPF 应用程序发送一些参数。怎么办?
从这里参考完整的代码
您可以从您的 winform 应用程序中传递参数,例如
Process.Start(new ProcessStartInfo(@"C:reposWpfApp.exe", "Args from WinForms"));
并在 WPF 应用程序中接收,例如
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)}");
}
}
}
您可以对几个参数使用相同的方法。所以在你的情况下
var procStart = System.Diagnostics.Process.Start(@"C:ABCWPF.exe", params);