views:

27

answers:

1

in the .net environment (C# language), how can I go about writing an application that can monitor when a process is created within the system, and when that process spawns other processes?

+2  A: 

You can use WMI

http://weblogs.asp.net/whaggard/archive/2006/02/11/438006.aspx

Note the WMI example there doesn't do exactly what you want, but it should give you enough pointers (plus the MSDN WMI docs) to figure out how to do what you want.

You can also use PInvoke in C# to do some window hooks that will send a message to your application when a process is created. However this will require some C++ for the dll you inject.

Paul