S
SLE
Hi there,
I am writing a service which monitors processes on the local machine.
Currently I have implemented a System.Management.ManagementEventWatcher
which raises events for processes being launched:
New WqlEventQuery("SELECT * FROM __InstanceCreationEvent WITHIN 0.1
WHERE TargetInstance ISA 'Win32_Process'")
So far so good but I need additional information (e.g. window title)
which I'm getting via the System.Diagnostics.Process:
p = Process.GetProcessById(pid)
....
windowTitle = p.MainWindowTitle
Problems occur when a lot of (concurrent) processes are launched in a
*short* period of time:
1) There is no WMI event for some processes (some events seem to be sunk)
2) When the WMI event comes in, the process might already been
terminated so the subsequent GetProcessById() fails.
Question:
Can I avoid WMI for having an event-driven model? Is there a *fast*,
event-driven way to detect processes being started/stopped?
I am writing a service which monitors processes on the local machine.
Currently I have implemented a System.Management.ManagementEventWatcher
which raises events for processes being launched:
New WqlEventQuery("SELECT * FROM __InstanceCreationEvent WITHIN 0.1
WHERE TargetInstance ISA 'Win32_Process'")
So far so good but I need additional information (e.g. window title)
which I'm getting via the System.Diagnostics.Process:
p = Process.GetProcessById(pid)
....
windowTitle = p.MainWindowTitle
Problems occur when a lot of (concurrent) processes are launched in a
*short* period of time:
1) There is no WMI event for some processes (some events seem to be sunk)
2) When the WMI event comes in, the process might already been
terminated so the subsequent GetProcessById() fails.
Question:
Can I avoid WMI for having an event-driven model? Is there a *fast*,
event-driven way to detect processes being started/stopped?