gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 12:20:51 25 4
gpt4 key购买 nike

谁能告诉我如何从 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com