Guest User

Untitled

a guest
Jun 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Text;
  5.  
  6. namespace processstudy
  7. {
  8. class ProcessWatch
  9. {
  10. public void watch()
  11. {
  12. // Process.Start("cmd.exe");
  13. var process = new Process();
  14. // process.StartInfo.UseShellExecute = false;
  15. // You can start any process, HelloWorld is a do-nothing example.
  16. process.StartInfo.FileName = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";
  17. process.Start();
  18. process.WaitForExit(1000);
  19. process.Kill();
  20. //Process.GetProcessById(process.Id).Kill();
  21. //Process.GetProcessById(process.Close).Kill();
  22. //process.StartInfo.CreateNoWindow = true;
  23. //process.Start();
  24. //process.WaitForExit(10000);
  25. //process.Kill();
  26.  
  27.  
  28.  
  29. }
  30. }
  31. }
  32.  
  33.  
  34. using System;
  35. using System.Diagnostics;
  36.  
  37. namespace processstudy
  38. {
  39. class Program
  40. {
  41. static void Main(string[] args)
  42. {
  43. ProcessWatch pW = new ProcessWatch();
  44. pW.watch();
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment