列出外部进程的运行线程 [英] List running threads of an external process

查看:76
本文介绍了列出外部进程的运行线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,我们的客户会收到幽灵"应用程序(这意味着当我们在很多时间(例如72个小时以上)后关闭应用程序时,有时会从外观上关闭该应用程序,但该应用程序仍在进程列表中.

由于我们无法轻松地进行复制,因此我们想知道哪个线程仍在运行.因此,我们想提供一个非常小的工具,在其中我们可以选择一个进程(选择一个幽灵"),然后显示我们可以获得的所有信息(大部分正在运行的线程名称).

所以:

  1. 这可能吗?我不知道c#应用程序是否可以访问 另一个应用程序的线程名?
  2. 是否存在任何可以进行这种提取"的应用程序
  3. 我们应该使用什么来访问这类信息?

解决方案

就像贾斯汀·哈维(Justin Harvey)所说的那样,Process Explorer是一个很好的解决方案.

如果您希望提供自己的工具,则可能会陷入困境:

Process.GetProcessByName() Process.Threads

用法

var process = Process.GetProcessByName("myprocess").FirstOrDefault();
var threads = process.Threads;

Sometimes we have "ghost" application by our customers(meaning that when we close the application after a lot of time(like 72+ hours), we have, sometimes the application that is visually closed but still in the process list.

Since we can't reproduce easily, we would like to know which thread is still running. So we would like to provide a very small tools, in which we can select a process(select the one that is a "ghost"), and then display all information that we can get (Threads names that are running mostly).

So:

  1. Is this possible ? I don't know if a c# application can access to the thread name of another application?
  2. Is there any existing application that can do this kind of "extraction"
  3. what should we use to access this kind of informations?

解决方案

As Justin Harvey mentioned, Process explorer is a good solution.

If you wish to provide your own tool, you could be interrested in :

Process.GetProcessByName() and Process.Threads

Usage

var process = Process.GetProcessByName("myprocess").FirstOrDefault();
var threads = process.Threads;

这篇关于列出外部进程的运行线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆