本文實例講述了C#列出當前系統所有正在運行程序的方法。分享給大家供大家參考。具體實現方法如下:
Using System.Diagnostics;foreach(Process p in Process.GetProcesses(System.Environment.MachineName)){ if (p.MainWindowHandle! = IntPtr.Zero) { // Display the user name of the program Console.WriteLine (p); //string s = p.ToString (); }}
希望本文所述對大家的C#程序設計有所幫助。
新聞熱點
疑難解答