- Home /
Question by
thorikawa · Dec 18, 2016 at 11:24 AM ·
windowsbackgroundwindows 10process
App goes to the background when an external process causes error. How to keep app foreground?
Environment
Windows 10 64bit and Unity 5.4.3f1
Description
My Unity app is a full-screen app on Windows and it executes an extern process by the following code.
var process = new System.Diagnostics.Process();
process.StartInfo.FileName = "C:\\path\\to\\my.exe";
process.StartInfo.Arguments = string.Format("");
process.EnableRaisingEvents = true;
process.Exited += MyProcess_Exited;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
As pasted above, I set UseShellExecute=false
and CreateNoWindow=true
for my app to stay foreground and not to produce any pop-ups. It works well (meaning my app stay foreground) if the external process finishes successfully, but if the external process causes error, my app silently goes to the background.
Is there any way to ignore error and keep my app foreground?
Comment