autoitxp Posted August 21, 2009 Share Posted August 21, 2009 Hi i need to know how to terminate firefox.exe or iexplorer.exe if some 1 try to open youtube. expandcollapse popup#include <file.au3> #include <INet.au3> Opt('MustDeclareVars', 1) Opt("TrayIconHide", 0) Local $ai_Handle_1 Local $ai_Handle_2 Local $ai_Handle_3 Local $Kerneldll = "kernel32.dll" While 1 Sleep(3000) Dim $s_Explore = _INetGetSource('http://192.168.1.12/ProcessList.txt') $s_Explore = StringSplit($s_Explore, @CRLF, 1) ;ConsoleWrite($s_Explore[0] & @CRLF) Dim $Status[$s_Explore[0] + 1] = [False] For $i = 1 To $s_Explore[0] If $s_Explore[$i] = "restart" Then ; MsgBox(0, "", "Restart") Run(@ComSpec & " /c " & 'SHUTDOWN -r -t 01', "", @SW_HIDE) EndIf If ProcessExists($s_Explore[$i]) And $Status[$i] = False Then $Status[$i] = True ConsoleWrite($s_Explore[$i] & " " & "Active" & @CRLF) Local $list = ProcessList($s_Explore[$i]) For $i = 1 To $list[0][0] $ai_Handle_1 = DllCall($Kerneldll, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', True, 'int', $list[$i][1]) If ($ai_Handle_1[0] <> 0) = True Then ConsoleWrite($list[$i][0] & " OpenProcess " & ($ai_Handle_1[0] <> 0) & @CRLF) $ai_Handle_2 = DllCall($Kerneldll, "int", "TerminateProcess", "int", $ai_Handle_1[0], "int", "") If ($ai_Handle_2[0] <> 0) = True Then ConsoleWrite($list[$i][0] & " TerminateProcess " & ($ai_Handle_2[0] <> 0) & @CRLF) EndIf $ai_Handle_3 = DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle_1[0]) If ($ai_Handle_3[0] <> 0) = True Then ConsoleWrite($list[$i][0] & " CloseHandle " & ($ai_Handle_3[0] <> 0) & @CRLF) EndIf EndIf Next EndIf If Not ProcessExists($s_Explore[$i]) And $Status[$i] = True Then $Status[$i] = False ConsoleWrite($s_Explore[$i] & " " & "Not Active" & @CRLF) EndIf Next WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now