Free mag vol1 | Page 690

CHAPTER 17  PROCESSES, APPDOMAINS, AND OBJECT CONTEXTS -> Mod Name: CRYPTBASE.dll -> Mod Name: mscoreei.dll -> Mod Name: SHLWAPI.dll -> Mod Name: GDI32.dll -> Mod Name: USER32.dll -> Mod Name: LPK.dll -> Mod Name: USP10.dll -> Mod Name: IMM32.DLL -> Mod Name: MSCTF.dll -> Mod Name: clr.dll -> Mod Name: MSVCR100_CLR0400.dll -> Mod Name: mscorlib.ni.dll -> Mod Name: nlssorting.dll -> Mod Name: ole32.dll -> Mod Name: clrjit.dll -> Mod Name: System.ni.dll -> Mod Name: System.Core.ni.dll -> Mod Name: psapi.dll -> Mod Name: shfolder.dll -> Mod Name: SHELL32.dll ************************************ Starting and Stopping Processes Programmatically The final aspects of the System.Diagnostics.Process class examined here are the Start() and Kill() methods. As you can gather by their names, these members provide a way to programmatically launch and terminate a process, respectively. For example, consider the following static StartAndKillProcess() helper method:  Note You must be running Visual Studio with Administrator rights in order to start new processes. If this is not the case, you will receive a runtime error. static void StartAndKillProcess() { Process ieProc = null; // Launch Internet Explorer, and go to facebook! try { ieProc = Process.Start("IExplore.exe", "www.facebook.com"); } catch (InvalidOperationException ex) { Console.WriteLine(ex.Message); } 633