在DELPHI 4 中如何知道主程序调用的一个外部程序(如ARJ)已运行结束,(50分)

使用FindWindow查看程序进程是否存在?<br>
 
uses tlhelp32<br>....<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var lppe: TProcessEntry32;<br>&nbsp; &nbsp; found : boolean;<br>&nbsp; &nbsp; Hand : THandle;<br>begin<br>&nbsp; Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);<br>&nbsp; found := Process32First(Hand,lppe);<br>&nbsp; while found do<br>&nbsp; begin<br>&nbsp; &nbsp; ListBox1.Items.Add(StrPas(lppe.szExeFile));<br>&nbsp; &nbsp; found := Process32Next(Hand,lppe);<br>&nbsp; end;<br>end;<br><br>然后设置time监控,隔一定时间扫描一次,发现新的进程<br>或kill了的进程!
 
特此声明:<br><br>以上代码引自<br>&lt;a href="http://www.gislab.ecnu.edu.cn/delphibbs/DispQ.asp?LID=93885"&gt;<br>应用程序如何得知(捕获)WIN95启动和关闭应用程序&lt;/a&gt;<br><br>原著: &nbsp; &nbsp; &nbsp;唐晓峰.<br>一次引用: &nbsp;zx.<br>二次引用: &nbsp;茶叶蛋.
 
多人接受答案了。
 
顶部