我相信我一直在采取正确的方法到目前为止,但我希望有一个按钮在我的电脑上启动视频游戏。C#Windows应用程序 - 链接一个按钮以启动游戏
到目前为止,我有一个按钮链接到一个过程:
void button2_Click(object sender, EventArgs e)
{
process1.Start();
}
this.process1.EnableRaisingEvents = true;
this.process1.StartInfo.Domain = "";
this.process1.StartInfo.FileName = "MBO\\marbleblast.exe";
this.process1.StartInfo.LoadUserProfile = false;
this.process1.StartInfo.Password = null;
this.process1.StartInfo.StandardErrorEncoding = null;
this.process1.StartInfo.StandardOutputEncoding = null;
this.process1.StartInfo.UserName = "";
this.process1.SynchronizingObject = this;
this.process1.Exited += new System.EventHandler(this.Process1Exited);
所以,在这里,我曾经放置EXE(在一个我编码),将推出子文件夹MBO下的“marbleblast.exe”相对于它的位置。
它似乎在工作,并试图启动游戏,但是,它说它无法加载那里的文件。我在没有我的发射器的情况下测试了游戏,并且它工作正常。我相信它试图运行EXE,但不让它使用其文件夹内的其他文件。
如果需要,我会给出更多细节。
如何让游戏正常运行?
仍然没有工作,虽然我得到的基本概念。编辑:它调整了一些调整后!非常感谢! – 2011-04-23 16:10:50