Hi, I'm having a strange problem with the following code, I'm writing a game launcher in VB.NET:
Dim gameProcess As Process = New Process()
gameProcess.StartInfo.UseShellExecute = False
gameProcess.StartInfo.FileName = TextBox2.Text
gameProcess.Start()
Debug.Print("Game started")
gameProcess.WaitForExit()
Debug.Print("Game stopped")
This code is working fine with most programs, but with some of them (Age of Empires e.g.), I get the following:
Game started
Game stopped
I see the game running for a split second in the task manager, but it immediately closes! Does anyone know why? When I run the game from Windows, it works fine.
I've also tried with Shell, same problem.
And I've tried with cmd.exe and the /C argument, same problem (note that when I type cmd.exe /C path_to_game_exe in the Windows Run Dialog, the game also starts fine), it's only when I launch it from the VB.NET app that it gives problems.
My last idea was to write a temporary batch file and starting that one, but that seems like an ugly solution.