Thread: kill process
View Single Post
  #2 (permalink)  
Old 06-23-2008, 03:44 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,897
Last Blog:
Web slideshow in JavaS...
Rep Power: 78
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: kill process

Your code logic is wrong. What you're saying is this:
If the process is called star, then check if the process is called firefox as well. If so, kill the process.
You see the problem?

Consider using a switch statement instead of multiple Ifs.
csharp Code:
  1. switch (p.ProcessName.ToLower())
  2. {
  3.  case "star": {}
  4.  case "firefox": {}
  5.  case "other":
  6.  {
  7.   p.Kill;
  8.   break;
  9.  }
  10. }
__________________


Mr. Xav | Website | Forums | Blog
Reply With Quote