c# - 从 C#/WPF 调用 C++ 程序

标签 c# c++ wpf

谁能告诉我如何从 C# 运行已编译的 C++ 程序(可执行文件)的完整示例。

提前致谢。

最佳答案

我认为你想要的是这样的:

Process myProcess = new Process();

try
{
    myProcess.StartInfo.UseShellExecute = false;
    // You can start any process; HelloWorld is a do-nothing example.
    myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
    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.
}
catch (Exception e)
{
    Console.WriteLine(e.Message);
}

关于c# - 从 C#/WPF 调用 C++ 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5181356/

相关文章:

C++ 数学没有产生正确的输出

c# - 结合 OrderBy 表达式和 Where 表达式

c++ - 在 C++ 中解释转义的 unicode 字符

javascript - 将 Html 扩展与 ActionLink 结合使用

c++ - 二维字符串匹配 : Baker-Bird Algorithm

c# - 使用切换按钮创建选择器

c# - 单击超链接时防止显示详细信息

c# - MVVM:将 ContentControl 绑定(bind)到 CheckBox

c# - 我需要处理 MessageBox 还是它会自行处理?

c# - 引用类型,StringBuilder