C# - Get list of open tasks

前端 未结 4 775
耶瑟儿~
耶瑟儿~ 2020-12-15 10:45

I\'m trying to find a way to get the open tasks in C#. I\'ve been searching on google and can only find how to get a list of the processes. I want the onl

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-15 11:25

    @abelenky17

    I suspect that this will not cover all cases, for example there are processes who have several top level windows (that all appear in the task manager). Consider for example: FireFox, Windows Explorer, IE, etc... those applications can have multiple windows on the desktop. Also, it will not handle Terminal Sessions scenario's properly (because you enumerate all the processes running in the system).

    @Dan C.

    Doing something like this:

    p.ProcessName != "explorer"
    

    seems ok to you? It smells, bad.

提交回复
热议问题