- 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 ();
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/040920135624.html
来源: http://www.codesnippet.cn/detail/040920135624.html