xqe 发表于 2009-7-19 18:29:14

想做一个监控进程的谁能给个代码

我想做一个监控进程的程序~要进程结束就发个邮件~偶这类代码吗?

109329767 发表于 2009-7-19 19:24:22

#include <Process.au3>
#include <INet.au3>

ProcessClose("notepad.exe")
$PID = ProcessExists("notepad.exe") ; 返回记事本程序的 PID,若未发现该进程则返回值为 0。
If $PID Then ProcessClose($PID)
$Address = InputBox('Address', 'Enter the E-Mail address to send message to')
$Subject = InputBox('Subject', 'Enter a subject for the E-Mail')
$Body = InputBox('Body', 'Enter the body (message) of the E-Mail')
MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $body))

109329767 发表于 2009-7-19 19:25:33

If ProcessExists("notepad.exe") Then
    MsgBox(0, "示例", "记事本运行中。")
EndIf

xqe 发表于 2009-7-20 10:51:26

那进程被终止后怎么发邮件呢 ??

lynfr8 发表于 2009-7-20 13:42:21

要进程结束就发个邮件
你究竟是要结束进程就先要发邮件
还是结束进程就发送邮件啊???

hnzzlzj 发表于 2009-8-30 15:44:47

呵呵,楼上问的是

hnzzlzj 发表于 2009-8-30 21:45:13

看出来楼主的意思了,楼主是想搞个软件检测指定进程,如果该进程结束了就向设定的邮箱发邮件通知。
页: [1]
查看完整版本: 想做一个监控进程的谁能给个代码