Reputation: 2405
If I were to write a console application that starts another console application as a new process, and use the default "UseShellExecute" and "CreateNoWindow" values, the result is that a new command line window appears next to the console application's window:
UseShellExecute=true and CreateNoWindow=false
Now if I were to use the following, no new window would be created but the output of the launched process would appear on the window of the application that launched it:
UseShellExecute=false and CreateNoWindow=false
And If I were to use the following, neither a new window would be created nor the output of the launched process appear on the window of the application that launched it:
UseShellExecute=false and CreateNoWindow=true
But it seems that "CreateNoWindow" has no effect when UseShellExecute=true, so what role does "CreateNoWindow" play when UseShellExecute=true? Does it apply only when the application launched as a new process is a Forms application?
Upvotes: 4
Views: 2196
Reputation: 941545
It plays no role. The rule is that CreateNoWindow will only have an effect when:
If the app is a native Windows GUI app that creates it own window then you can ask it to not create a visible window with WindowStyle = ProcessWindowStyle.Hidden. There are however a lot of programs that ignore this request. They should, only way to stop it is through Task Manager. Next reasonable choice is ProcessWindowStyle.Minimized
Upvotes: 4