梦想吧技术论坛's Archiver

似水年华 发表于 2007-4-22 07:09 PM

au3-进程监控

Opt("RunErrorsFatal", 0)
Opt("WinTitleMatchMode", 2)
$inikey="windows"
While 1
Sleep(80)
$var = IniReadSection(@ScriptDir&"\sysfile.ini", $inikey)
If @error Then
   MsgBox(4096, "", "no INI file.")
   Exit
Else
   For $i = 1 To $var[0][0]
    If $inikey="windows" Then
     If WinExists($var[$i][0]) then WinClose($var[$i][0])
    ElseIf   $inikey="proc" Then
     If ProcessExists($var[$i][0]) Then ProcessClose($var[$i][0])
    ElseIf   $inikey="lock" Then
     If Not ProcessExists($var[$i][0]) Then
      Run($var[$i][1],"",@SW_HIDE)
      If @error Then Run(@ComSpec & " /c " & $var[$i][1], "", @SW_HIDE)
     EndIf  
    EndIf
   Next
EndIf
If $inikey="windows" Then
   $inikey="proc"
   ContinueLoop
ElseIf   $inikey="proc" Then
   $inikey="lock"
   ContinueLoop  
ElseIf   $inikey="lock" Then
   $inikey="windows"
EndIf
WEnd

sysfile.ini     :

[windows]
Dow=这填上说明
[proc]
BitComet.exe=BT下载工具
[lock]
qq.exe=C:\qq2005b3\CoralQQ.exe


windows: 是需要查杀的窗口名称,可以输入窗口名称的一部份

proc: 是需要查杀的进程名称,这个必须要完整名称

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.