How do task killers work?

In a nutshell, Automatic Task Killers work by polling the OS for a list of currently running processes and the memory they are consuming. Then either with an intelligent algorithm or with user input the Task Killers issue a call to the system telling the system to kill the process. There are two apis you … Read more

Why is calling Process.killProcess(Process.myPid()) a bad idea?

<rant> In a perfect world, with perfect code and libraries, you shouldn’t need to call Process.killProcess(Process.myPid()) and the OS will correctly kill your application as appropriate. Also there will be peace in the Middle East, pigs will fly, and the halting problem will be solved. Because all of these things haven’t happened yet there are … Read more

Closing Excel Application Process in C# after Data Access

Try this: excelBook.Close(0); excelApp.Quit(); When closing the work-book, you have three optional parameters: Workbook.close SaveChanges, filename, routeworkbook Workbook.Close(false) or if you are doing late binding, it sometimes is easier to use zero Workbook.Close(0) That is how I’ve done it when automating closing of workbooks. Also I went and looked up the documentation for it, and … Read more

Kill process tree programmatically in C#

This worked very nicely for me: /// <summary> /// Kill a process, and all of its children, grandchildren, etc. /// </summary> /// <param name=”pid”>Process ID.</param> private static void KillProcessAndChildren(int pid) { // Cannot close ‘system idle process’. if (pid == 0) { return; } ManagementObjectSearcher searcher = new ManagementObjectSearcher (“Select * From Win32_Process Where ParentProcessID=” … Read more