-2

How i can hide or minimize window of process window after starting?

P.S RedirectStandardOutput me need.I tryed use WinAPI - ShowWindow(handle, SW_HIDE); But it's did't works too

Process process = new Process();
process.StartInfo.FileName = processName;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.Start();
process.OutputDataReceived += OnDataReciever;
process.BeginOutputReadLine();
Alex
  • 66
  • 8
  • Process - it's another console application.... – Alex Aug 20 '16 at 06:49
  • Possible duplicate of [How to Run a C# console application with the console hidden](http://stackoverflow.com/questions/836427/how-to-run-a-c-sharp-console-application-with-the-console-hidden) – IInspectable Aug 20 '16 at 19:31
  • me need a acesss to read window title – Alex Aug 20 '16 at 20:25
  • I'm not a mind reader. Nothing in your question talks about the console's window title. This is a surprising requirement, too, as it's not generally useful. – IInspectable Aug 20 '16 at 20:32

1 Answers1

3

As I understand your problem the child process is a console app, based on your comment to the question. In which case set

process.StartInfo.UseShellExecute = false;   
process.StartInfo.CreateNoWindow = true;

before starting the process. Discussion of the various options can be found here: .NET - WindowStyle = hidden vs. CreateNoWindow = true?

Community
  • 1
  • 1
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • yeap i will can do it, but me need access to window title, but with now window style, it's impossible, or have any way's for it? (noWindow+ a lot of WinApi for get title text) – Alex Aug 20 '16 at 20:03
  • Not according to the question that was asked. If you want to ask about window styles that's something else altogether. I just answered the question that was asked. – David Heffernan Aug 21 '16 at 07:21