我相信我一直在採取正確的方法到目前爲止,但我希望有一個按鈕在我的電腦上啓動視頻遊戲。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