banks Posted July 25, 2012 Report Share Posted July 25, 2012 Salut doresc sa inchid toate procesele cu numele notepad de exemplu dar doar din userul activ. foreach (System.Diagnostics.Process myProc in System.Diagnostics.Process.GetProcesses()) { if (myProc.ProcessName == "notepad" ) { myProc.Kill(); } }Daca folosesc ce am scris mai sus , daca am notepad deschis in oricare user se va termina procesul..Eu doresc sa se termine procesul doar din userul curent..cum trebuie sa fac? Quote Link to comment Share on other sites More sharing options...
SirGod Posted July 25, 2012 Report Share Posted July 25, 2012 Mai baga o conditie in IF. Vezi daca utilizatorul curent e cel pe care il "vrei".how to get current username in .net using c#? - Stack OverflowSau:How do you kill a process for a particular user in .NET (C#)? - Stack Overflow Quote Link to comment Share on other sites More sharing options...
banks Posted July 25, 2012 Author Report Share Posted July 25, 2012 Mai baga o conditie in IF. Vezi daca utilizatorul curent e cel pe care il "vrei".how to get current username in .net using c#? - Stack OverflowSau:How do you kill a process for a particular user in .NET (C#)? - Stack OverflowDaca pun un if cu userul activ va face asa:Cauta numele userului activ sa zicem Ion.foreach (System.Diagnostics.Process myProc in System.Diagnostics.Process.GetProcesses()){if (myProc.ProcessName == "notepad" && numele activ=="ion" ){myProc.Kill();}}Se va inchide notepad peste totpentru ca cel activ este ion..deci nu ajuta..cat despre linkurile care le-ai dat acum le incerc, mersi mult pentru ele. Quote Link to comment Share on other sites More sharing options...
zorro59 Posted July 27, 2012 Report Share Posted July 27, 2012 (edited) How do I determine the owner of a process in C#? - Stack Overflowhttp://stackoverflow.com/questions/300449/how-do-you-get-the-username-of-the-owner-of-a-processIa vezi daca asa ceva iti trebuie Edited July 27, 2012 by zorro59 Quote Link to comment Share on other sites More sharing options...