gpt4 book ai didi

c# - 使用 Process.Start 运行程序时,找不到它的资源文件

转载 作者:行者123 更新时间:2023-11-30 14:09:06 24 4
gpt4 key购买 nike

我有这个代码:

private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.FileName = "C:/Users/Valy/Desktop/3dcwrelease/3dcw.exe";
p.Start();
}

3dcw.exe 是一款用于 OpenGL 图形的应用程序。

问题是当我点击按钮时,可执行文件运行,但它不能访问它的纹理文件。

有人有解决办法吗?我想像在后台加载位图文件,然后运行 ​​exe 文件,但我该怎么做?

最佳答案

我在互联网上搜索了您问题的解决方案,并找到了这个网站:http://www.widecodes.com/0HzqUVPWUX/i-am-lauching-an-opengl-program-exe-file-from-visual-basic-but-the-texture-is-missing-what-is-wrong.html

在 C# 代码中它看起来像这样:

string exepath = @"C:\Users\Valy\Desktop\3dcwrelease\3dcw.exe";
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exepath;
psi.WorkingDirectory = Path.GetDirectoryName(exepath);
Process.Start(psi);

关于c# - 使用 Process.Start 运行程序时,找不到它的资源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31316395/

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