Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public class MyClass
  2.  
  3. {
  4. public ManagementEventWatcher mywatch;
  5.  
  6. public start(){
  7. string queryString =
  8. "SELECT TargetInstance.Name FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA 'Win32_Process'";
  9.  
  10. // The dot in the scope means use the current machine
  11. string scope = @"\\.\root\CIMV2";
  12.  
  13. // Create a watcher and listen for events
  14. this.watch = new ManagementEventWatcher(scope, queryString);
  15. this.watch.EventArrived += ProcessStarted;
  16.  
  17. this.watch.Start();
  18. MessageBox.Show("log startet");
  19. }
  20.  
  21. public stop(){
  22. this.watch.stop()
  23. }
  24. }
  25.  
  26. m = MyClass()
  27. m.start()
  28. m.setmytimer(10minutes)
  29. m.stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement