繁体   English   中英

希望C#程序启动WPF应用

[英]Want C# program to launch a WPF app

我发现有必要从ac#程序内部启动WPF应用程序。 我编写了一个简单的WPF浏览器,称为eBrowse,作为我的练习。 然后,要求我将其添加到已在使用的ac#程序中。

我尝试了System.Diagnostics.Process.Start(@"C:\\eBrowse"); 但这没用。

在网站上发现的另一种可能性:

myProcess.StartInfo.UseShellExecute = true;
// You can start any process, HelloWorld is a do-nothing example.
//myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
myProcess.StartInfo.FileName = @"C:\eBrowse";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
// This code assumes the process you are starting will terminate itself. 
// Given that is is started without a window so you cannot terminate it 
// on the desktop, it must terminate itself or you can do it programmatically
// from this application using the Kill method.

我想知道是否可能无法从c#启动WPF应用程序。 任何想法都很棒。

我认为您未指定EXE名称。 请尝试以下操作:

myProcess.StartInfo.FileName = @"C:\eBrowse\yourEXeName.exe"; 

记得添加.exe扩展名。 CreateNoWindow应该为false

using System.Diagnostics;

Process myProc;
myProc = Process.Start("calc.exe");

使用Visual Studio 2008/10在我的系统上编译并运行。

只需将calc.exe与exe的完整路径交换即可。

这对您有用吗? Winforms / WPF的互操作性

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM