As the title says, In my code I have registered a callback function when a program launches using WMI:
ManagementEventWatcher Watcher = new ManagementEventWatcher(new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace WHERE ProcessName='ExampleApp.exe'"));
Before my application exits do I have to call:
Watcher.Stop();
Watcher.Dispose();
Or is it done automatically. The reason I ask is that my application that is subscribing to the event will be Process.Kill()
by another application, rather than gracefully terminating so it doesn't not have the chance to properly unsubscribe.
Thanks