start / stop process

  • Thread starter Thread starter tascien
  • Start date Start date
T

tascien

Hi guys, I would like to be able to open a program and close it wright
within vb...

' this one works...
Process.Start("c:\someProgram.exe")

Thread.sleep(5000)

' this one doesn't !
Process.Stop()

how can I do the second? any ideas?
 
Hi Tacien,

Keep a reference to the process when you start it.

Process p = Process.Start("Notepad.exe");

You can then, call CloseMainWindow() for windows application or Kill() to
end the process.

p.CloseMainWindow();

or

p.Kill();
 
Back
Top