函数说明

ProcessExists

检查指定进程是否存在。

ProcessExists ( "进程名" )

 

参数

进程名 目标进程的名称或 PID(进程标识符)。

 

返回值

成功: 返回目标进程的 PID。
失败: 返回值为0,说明指定进程并不存在。

 

注意

进程名是指可执行文件的名称(无需给出完整路径),例如:"notepad.exe" 或 "winword.exe"
PID 是标识进程的唯一的数值。
为使 ProcessExists 函数能在 Windows NT 4.0 下工作,系统还需要一个 DLL 文件(PSAPI.DLL,已包含在 AutoIt 的安装目录下)。
每隔 250 毫秒左右进程将被检测一次。

 

相关

ProcessClose, ProcessWait, ProcessWaitClose, WinExists

 

示例


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