加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 23:26:36 所属栏目:百科 来源:网络整理
导读:我有这个代码: 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图形的应用程序. 问题是,当我单击按钮时
我有这个代码:

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:UsersValyDesktop3dcwrelease3dcw.exe";
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exepath;
psi.WorkingDirectory = Path.GetDirectoryName(exepath);
Process.Start(psi);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读