⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 054.htm

📁 Delphi书籍--Delphi网上教程
💻 HTM
字号:
<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=GB2312"><TITLE>-->DELPHI专题文档-程序应用-->Win95/98下监控运行的其他程序</TITLE>
<META NAME="keywords" CONTENT=" DELPHI专题文档-程序应用 Win95/98下监控运行的其他程序">
<META NAME="description" CONTENT=" - DELPHI专题文档-程序应用 - Win95/98下监控运行的其他程序">

<style>
<!--
#page {position:absolute; z-index:0; left:0px; top:0px}
.tt3 {font: 9pt/12pt "宋体"}
.tt2 {font: 12pt/15pt "宋体"}
a {text-decoration:none}
a:hover {color: blue;text-decoration:underline}
-->
</style>
</HEAD>
<a href="index6.html">返回</a>

<body text="#000000" aLink=#9900ff link=#006699 vLink=#006699 bgcolor="#FFFFFF" leftmargin="3" topmargin="3" marginheight="3" marginwidth="3">
<TABLE WIDTH="100%" CELLPADDING=10 CELLSPACING=0 BORDER=0>
<TR>

<TD class="tt2" bgcolor="#F5F8F8" width="84%"><center><B><FONT style="FONT-SIZE: 16.5pt" COLOR="#FF6666" FACE="楷体_GB2312">Win95/98下监控运行的其他程序</FONT></B></center>
<hr color="#EE9B73" size="1" width="94%">
<p class="tt2">参照下面这段程序,就搞定了啦。^-^<br>
<br>
uses ... TLHelp32, ...<br> 
<br> 
type<br> 
TForm1 = class(TForm)<br> 
...<br> 
end;<br> 
var<br> 
Form1: TForm1;<br> 
l : Tlist; ////返回的东东在&quot;L&quot;这个TList中。<br> 
<br> 
type<br> 
TProcessInfo = Record<br> 
ExeFile : String;<br> 
ProcessID : DWORD;<br> 
end;<br> 
<br> 
pProcessInfo = ^TProcessInfo;<br> 
<br> 
implementation<br> 
{$R *.DFM}<br> 
procedure TForm1.FormCreate(Sender: TObject);<br> 
var p : pProcessInfo;<br> 
i : integer;<br> 
ContinueLoop:BOOL;<br> 
var<br> 
FSnapshotHandle:THandle;<br> 
FProcessEntry32:TProcessEntry32;<br> 
begin<br> 
l := TList.Create;<br> 
l.Clear;<br> 
FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br> 
FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);<br> 
ContinueLoop:=Process32First(FSnapshotHandle,FProcessEntry32);<br> 
while integer(ContinueLoop)&lt;&gt;0 do<br> 
begin<br> 
New(p);<br> 
p.ExeFile := FProcessEntry32.szExeFile;<br> 
p.ProcessID := FProcessEntry32.th32ProcessID;<br> 
l.Add(p);<br> 
ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32);<br> 
end;<br> 
end;<br> 
<br> 
procedure TForm1.FormDestroy(Sender: TObject);<br> 
var p : pProcessInfo;<br> 
i : integer;<br> 
begin<br> 
With l do<br> 
for i := Count - 1 DownTo 0 do<br> 
begin p := items[i]; Dispose(p); Delete(i); end;<br> 
end;<br> 
</p> 
<p class="p2">...<br> 
end. </p> 
<hr color="#EE9B73" size="1" width="94%"> 
 
</TD> 
 
</TR> 
</table> 
</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -