我如何获取一个列表与我的应用程序创建的所有线程 [英] How can I get a list with all the threads created by my application

查看:107
本文介绍了我如何获取一个列表与我的应用程序创建的所有线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序中获取一个包含所有线程(主要的GUI线程除外)的列表,以便与它们进行一些操作。 (设置优先级,杀死,暂停等)
怎么做?

I want to get a list with all the threads (except the main, GUI thread) from within my application in order to do some action(s) with them. (set priority, kill, pause etc.) How to do that?

推荐答案

您可以使用我的 TProcessInfo 类:

var
  CurrentProcess : TProcessItem;
  Thread : TThreadItem;
begin
  CurrentProcess := ProcessInfo1.RunningProcesses.FindByID(GetCurrentProcessId);
  for Thread in CurrentProcess.Threads do
    Memo1.Lines.Add(Thread.ToString);
end;

这篇关于我如何获取一个列表与我的应用程序创建的所有线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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