op: "So, I'm trying to start a process from VB"
Code:
Dim p() As Process = Process.GetProcesses
For Each i As Process In p
If i.ProcessName = "processname" Then
End If
Next i
using the above code would return the 'first instance' of the process found running (in-case you have multiple copies open, ever)
op is probably using Process.Start("C:/theGame.exe") and assigned the return value of that function to some variable. I want to see though. Post some code op :b
Code:
MyProcess = Process.Start("C:/theGame.exe")
...
If MyProcess.HasExited = True Then
'safe to check MyProcess.ExitCode
''''return 0 in case of sucess, -1 or -2 in case of error
If MyProcess.ExitCode = 0 Then
Msgbox("Target Program closed with 0 errors - All to the good.")
Else
MsgBox("Target Program Crashed / Reported Error - ERROR")
End If
Else
'don't check it yet
End If
-----------
"I tryed using MyProcess.ExitCode"
How/where did you call it? Inside a timer? Or a button_click, or ?
Idk, but I think as long as you check (apparently have to) .HasExited() = True, it should be ok.
edit: you can use @
Xzevos's code, later, to find the ExitCode of other processes, not just ones you* start. useful.