The process will not be minimized in C #

pro.StartInfo.FileName = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"; pro.StartInfo.Arguments = a; pro.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; pro.Start(); 

I have this code above which Firefox runs. but Firefox does not actually start with a minimum, but like a normal window. What is the problem with my code? Do I have to sleep a thread for 100 ms?

+5
source share
1 answer

Try the following :)

 pro.StartInfo.FileName = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"; pro.StartInfo.Arguments = a; pro.UseShellExecute = true; pro.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; pro.Start(); 

I think this will only work if firefox is NOT working. In addition, it will still open firefox, but it will not be minimized. If you want to minimize your own launch of firefox, if the process is already completed, you need to process ShowWindow , as described here .

0
source

All Articles