|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Kill a dead processI have a Windows service that creates several instances of Access.Application connected to a ADP project. I want my service to check the activity of these instances and kill them as needed. I managed to get the Process object related to each instance and now I want to use a PerformanceCounter to check the process CPU usage, with the following code PerformanceCounter pc=new PerformanceCounter("Process", "% Processor Time"); pc.InstanceName = accessprocess.ProcessName; pc.NextValue(); if (pc.NextValue() > 90) accessprocess.Kill(); Only problem is that each instance has the same ProcessName (namely, MSACCESS)!!! How can I retrieve a valid InstanceName for each instance? Or, how can I accomplish this task in a different way? Thanks in advance! |
|||||||||||||||||||||||