Retrieve a complete processes list using C#

前端 未结 3 1237
遇见更好的自我
遇见更好的自我 2020-12-02 02:49

I am trying to write a C# program to retrieve a complete process list. However I find that an application open a window but I don\'t see it in the process tab of Windows tas

3条回答
  •  感情败类
    2020-12-02 03:34

    There are no hidden processes on Windows. Only processes you do not have (security) rights to see.

    A process running as an administrator (in Vista/Win7/Win2k8 would need to be elevated) will always be able to see all processes.

    However, a console application that lists the processes may well exit before Task Manager's display refreshes, and thus won't be seen. This is likely with a simple program even with update speed set to "high".

    You need to keep your process around until Task manager has updated its display. The simplest way would be do add the following statements to the end of your Main method:

    Console.Write("Press ENTER to exit");
    Console.ReadLine();
    

提交回复
热议问题