RSS订阅 | 匿名投稿
您的位置:网站首页 > 进程 > 正文

Delphi 一个不错的枚举进程例子

作者:admin 来源:未知 日期:2010/5/9 16:50:11 人气: 标签:

Delphi 一个不错的枚举进程例子

代码很少 感觉很不错 芊芊小魔女的博客看到的 ! 喜欢的顶下

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls,TlHelp32 ;

type
TForm1 = class(TForm)
lst1: TListBox;
tmr1: TTimer;
procedure tmr1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.tmr1Timer(Sender: TObject);
var
prophoto:THandle ;
openpro:ProcessEntry32;
bfirst:Boolean;
begin
lst1.Clear;
prophoto := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
openpro.dwSize := SizeOf(openpro);
bfirst:=Process32First(prophoto,openpro);
while bfirst <> False do
begin
lst1.Items.Add(openpro.szExeFile + ' PID : ' +inttostr(openpro.th32ProcessID));
bfirst:=Process32Next(prophoto,openpro);
end;
CloseHandle(prophoto);

end;

end.

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址: