c# - How to catch new processes starting and stopping? -
this question has answer here:
- how detect process start & end using c# in windows? 1 answer
- .net process monitor 2 answers
i wanted know if knows of way catch new applications starting or stopping on computer. instance, user logs in , opens word, outlook, or ie. want catch instance opening. have been working process.
i building service runs in background , writes event log.
public string applicationid() { process p = new process(); string application = p.processname.tostring(); return application; }
i know foreach process list. pointers or samples great.
once have process object, can add handler "exited" event detect when stops. note "enableraisingevents" property must set "true" work, can set after process object using getprocesses().
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.exited.aspx
Comments
Post a Comment