Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi,

I am developing one windows application,within that i am calling one process,but i don't want show that process window in foreground so i am using
System.Diagnostics.ProcessWindowStyle.Minimized but it is not working in windows 7

What I have tried:

i tried following

StartInfo.WindowStyle = ProcessWindowStyle.Minimize;
StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
StartInfo.UseShellExecute = false;
Posted
Updated 14-May-22 6:15am

I believe that UseShellExecute must be true to get the WindowStyle to work.

Ignore the MS documentation at ProcessWindowStyle Enumeration (System.Diagnostics)[^] which says the exact opposite!

It is also possible for an application to be written in such a way that it ignores a style request from the shell.

Alan.
 
Share this answer
 
Comments
peterkmx 12-Mar-22 13:41pm    
" ... UseShellExecute must be true to get the WindowStyle to work"

Your comment solved my problem, upvoted your answer, 5 years on :-) and still relevant.
Thank you!
In PS I had same problem .StartInfo.Hidden = $true was not enough !
It was not possible to use UseShellExecute $true since I needed to capture output.

I had to add also .StartInfo.CreateNoWindow = $true

And then it worked :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900