G
Guest
Hi All!
I've run into this problem and I would like you to help me please.
Before run my app, I need to iterate through the system process list and kill some processes that consume a lot of CPU, just to free memory:
Dim mProc As Process
For Each mProc In System.Diagnostics.Process.GetProcesses()
If InStr(mProc.ProcessName, "P1", CompareMethod.Text) > 0 Then mProc.Kill()
If InStr(mProc.ProcessName, "P2", CompareMethod.Text) > 0 Then mProc.Kill()
If InStr(mProc.ProcessName, "P3", CompareMethod.Text) > 0 Then mProc.Kill()
Next
The problem is that I got this exception with some of them:
System.ComponentModel.Win32Exception: Access Denied
The same happens when I try to change their PriorityClass property. All I know is that these processes are started by a Windows Service, it seems that they are kind of protected ??? Maybe I can stop the service directly instead (if I know how to do it of course
)
Does anybody have any idea to work around this?? I'm new in .NET...
Thanks in advance,
Fernando Paes
I've run into this problem and I would like you to help me please.
Before run my app, I need to iterate through the system process list and kill some processes that consume a lot of CPU, just to free memory:
Dim mProc As Process
For Each mProc In System.Diagnostics.Process.GetProcesses()
If InStr(mProc.ProcessName, "P1", CompareMethod.Text) > 0 Then mProc.Kill()
If InStr(mProc.ProcessName, "P2", CompareMethod.Text) > 0 Then mProc.Kill()
If InStr(mProc.ProcessName, "P3", CompareMethod.Text) > 0 Then mProc.Kill()
Next
The problem is that I got this exception with some of them:
System.ComponentModel.Win32Exception: Access Denied
The same happens when I try to change their PriorityClass property. All I know is that these processes are started by a Windows Service, it seems that they are kind of protected ??? Maybe I can stop the service directly instead (if I know how to do it of course

Does anybody have any idea to work around this?? I'm new in .NET...
Thanks in advance,
Fernando Paes