I have an application. If the application is not used in 15 mins it needs to closes all other applications (forced closed) and the timer starts again. I do not want to crash windows 7 doing this. So far I have the following:
Process me = Process.GetCurrentProcess();
foreach (Process p in Process.GetProcesses())
{
if (p.Id != me.Id
&& p.ProcessName != "winlogon.exe"
&& p.ProcessName != "explorer.exe"
&& p.ProcessName != "System Idle Process"
&& p.ProcessName != "taskmgr.exe"
&& p.ProcessName != "spoolsv.exe"
&& p.ProcessName != "csrss.exe"
&& p.ProcessName != "smss.exe"
&& p.ProcessName != "svchost.exe "
&& p.ProcessName != "services.exe"
)
{
p.Kill();
}
}
Sadly windows dies (blue screen). Is there any way I could close all the processes for the active use then hopefully Windows may survive.
This seems to be working.