首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

如何得到类似任务管理器一样的功能

2012-03-31 
怎么得到类似任务管理器一样的功能啊并且要像任务管理器一样可以操作[解决办法]先把进程枚举出来,然后再写

怎么得到类似任务管理器一样的功能啊
并且要像任务管理器一样可以操作

[解决办法]
先把进程枚举出来,然后再写操作

procedure TForm1.Button1Click(Sender: TObject);
var lppe:Tprocessentry32;
hh,tt:Thandle;
tppe:TThreadEntry32;
PId:Dword;
begin
hh:=createtoolhelp32snapshot(TH32CS_SNAPPROCESS,0);
lppe.dwsize:=sizeof(lppe);
tppe.dwsize:=sizeof(tppe);
if process32first(hh,lppe) then
repeat
pid:=lppe.th32ProcessID;
listbox1.items.add(format('<%x>%s',[pid,extractfilename(lppe.szExeFile)]));
tt:=createtoolhelp32snapshot(TH32CS_SNAPTHREAD,0);
if thread32first(tt,tppe) then
repeat
if tppe.th32OwnerProcessID=pid then
listbox1.items.add(format(' theadid:<%x>',[tppe.th32threadid]));
until not thread32next(tt,tppe);
closehandle(tt);
until not process32next(hh,lppe);
CloseHandle(hh);
edit1.text:=inttostr(listbox1.items.count);
end;




uses tlhelp32;


感觉你还不如直接把任务管理器调出来省事
[解决办法]
winexec(‘taskmgr.exe',sw_show);

热点排行