471,310 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Capturing processes

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?
--
SLE
Jul 21 '05 #1
0 846

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by SLE | last post: by
33 posts views Thread by Joerg Schuster | last post: by
14 posts views Thread by Brent Burkart | last post: by
6 posts views Thread by Ed Leafe | last post: by
3 posts views Thread by danbrotherston | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.