Jump to content

Killing zombies processes of Internet Explorer


 Share

Recommended Posts

I imagine it may because you have multiple processes with the same name and just using the process name will not close each different PID.

To work around that you can do something like this.

Local $sString = "name"

Local $list = ProcessList()
For $i = 1 To $list[0][0]
    If StringRegExp($list[$i][0], "^" & $sString & "\d+\.exe$") Then ProcessClose($list[$i][1])
Next

Or if you suck at RegEx like me StringinStr() works as well.

Local $list = ProcessList()
For $i = 1 To $list[0][0]
    If StringinStr($list[$i][0], "notepad") Then ProcessClose($list[$i][1])
Next

You can test what I am talking about by changing the last "1" in the ProcessClose() to 0 and then it closes the process by name instead of PID, open more than one notepad and you will see it close one instead of all of them. 

Edited by ViciousXUSMC
Link to comment
Share on other sites

I'm another problem now.

IE when you are with an open window it becomes the parent process, and the other tabs or windows that are created become children of this process.

Kill all processes before creating my window is not my solution, since in a situation where I need another IE window open it will close automatically.

I need to kill the process I create at the end of my test, so far I can get the id of the parent process, but I can not take the child process that was created.

The function I use is _WingGetProcess

Any suggestion ?

Link to comment
Share on other sites

local $oie = _IECreate("www.myapp.com.br")
local $window = WinWait("[CLASS:IEFrame]", "", 10)

local $process = WinGetProcess(WinGetHandle($window))

; the application does what it has to do

; when finished
_IEAction($oie,"quit")
ProcessClose($process)

Kylomas,

My code is the one above, can not go much in detail because it is a professional application. My goal is to kill a process that I created, but this process can be my son

Link to comment
Share on other sites

ProcessCloseAll("iexplorer.exe")
Func ProcessCloseAll($Process);Same as ProcessClose, except it closes all pid for that Process name.
    Global $Processes = ProcessList($Process);get all currently running Processes
    ;OP, ShellExecute whatever window or program you need to remain open. You should also add a Sleep() timer after this line. 
    For $i = 1 To $Processes[0][0]; For Each found unique PID
        ProcessClose($Processes[$i][1]);Close Process
    Next
EndFunc

This is the function I use to close multiple pid sharing the same process name at once. I placed a comment where you should ShellExecute() if you need that process to stay open(this will not work if your app required the parent PID to remain open).

 

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...