Why DOS Window can not be minimized/hidden

C

cemal eroglu

Hi,
I don't use CreateNoWindow=True since I would like to see this application on the task manager (as an application) and I should be able to end the task (and its child processes etc). So I used
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;

However my dos window is still maximized. Here is the code snippet
------------------------
process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.StartInfo.FileName = cmd;
process.StartInfo.Arguments = Arguments;
process.StartInfo.WorkingDirectory = WorkingDirectory;
process.Start();

---------------------

I also used Hidden but it did not work either.

UPDATE: Somehow DOS window created is not minimized/hidden. However, I worked around this by calling win32 library functions (SendMessage) with SW_HIDE after starting the process. That worked well. However since the process is not a message loop (not UI) WaitForInputIdle does not work to wait for to get the window handle. Instead, used Thread.Sleep until the dos window is ready to give hWND other than 0. But this solution seems nasty to me.

However, if someone has any other idea, that would be appreciated!

Cemal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top