Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

  1. /********************************************************************
  2. * Project : C:\DEPOT\multimedia\eHomeTest\UserXp\Proctest\Proctest.sln
  3. * File : Class1.cs
  4. * Summary : Test ability to get process ID and then kill a process cleanly
  5. * Classes :
  6. * Notes :
  7. * *****************************************************************/
  8. using System;
  9. using System.Diagnostics;
  10. namespace Proctest
  11. {
  12. /// <summary>
  13. /// Summary description for Class1.
  14. /// </summary>
  15. class ProcTestApp
  16. {
  17. /// <summary>
  18. /// The main entry point for the application.
  19. /// </summary>
  20. [STAThread]
  21. static void Main(string[] args)
  22. {
  23. Process[] procarray = Process.GetProcesses();
  24. foreach (Process p in procarray)
  25. {
  26. Console.WriteLine("{0} {1}", p.Id, p.ProcessName);
  27. if ( String.Compare(p.ProcessName,"wmplayer", true) == 0 )
  28. {
  29. p.Kill();
  30. }
  31. }
  32. Console.WriteLine("Press ENTER to exit");
  33. Console.ReadLine();
  34. }
  35. }
  36. }