如何从 Windows 窗体运行/调用 WPF 应用程序 (.exe)?我知道可以像下面这样完成:
Process.Start(@"C:\ABC\WPF.exe");
但我想从 winform 应用程序向 WPF 应用程序发送一些参数。怎么做 ?
完整代码请参考here https://github.com/vkgpt11/StackOverFlowSuppot/tree/master/MixedDesktopApps
您可以从 winform 应用程序传递参数,例如
Process.Start(new ProcessStartInfo(@"C:\repos\WpfApp.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)}");
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)