gavriel ankri

gavriel ankri

  • NA
  • 39
  • 48.4k

how to Minimize a process and then kill it

Mar 9 2011 4:31 AM
hello.  I am new in this forum and I hope you can help me.

I am trying to open an application,  minimize it  and then kill it when I click on a button.

I did it like this:

    Process newProcess = Process.Start("wmplayer.exe");
            newProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;


and then kill it when i press a button:

            if (newProcess != null)
                newProcess.Kill();
          

everything ok except the Minimize.  the application start in full windows and I dont know how to Minimize it.
If I do like this its work for me:
   ProcessStartInfo newprocess = new  ProcessStartInfo("wmplayer.exe");
          newprocess.WindowStyle = ProcessWindowStyle.Minimized;

but then I cant kill the process.


I hope you can hep me
thank you









Answers (4)