Local $MonitorDir='D:\My Tool\'
While 1
$array=ProcessList()
For $i=1 To $array[0][0]
If StringInStr(_GetModuleFileNameEx($array[$i][1]),$MonitorDir) Then ProcessClose($array[$i][1])
Next
Sleep(250)
WEnd
Func _GetModuleFileNameEx($_Pid)
$_Hwnd=DllCall("Kernel32.dll","hwnd","OpenProcess","dword",0x0400+0x0010,"int",0,"dword",$_Pid)
$_Return=DllCall("Psapi.dll","long","GetModuleFileNameEx","hwnd",$_Hwnd[0],"long",0,"str",0,"long",255)
DllCall("Kernel32.dll","int","CloseHandle","hwnd",$_Hwnd[0])
If StringInStr($_Return[3],"") Then Return $_Return[3]
Return ""
EndFunc
|