Archive: about KillProcDLL::KillProc


about KillProcDLL::KillProc
  I have tried to use killproc to kill all processes with a name. Inevitably, it kills only one of them with that name. How can I make it kill them all?

Examples:my PC is running 4 programs. I want to use "KillProcDLL::KillProc" to kill all them,when i install/Uninstall.


Perhaps it would be better to use this plugin:
http://nsis.sourceforge.net/wiki/Processes_plug-in
Use the FindProcess function in a loop with KillProcess.

Stu


Originally posted by Afrow UK
Perhaps it would be better to use this plugin:
http://nsis.sourceforge.net/wiki/Processes_plug-in
Use the FindProcess function in a loop with KillProcess.

Stu
sorry sir.
I don't konw how to write Use the FindProcess function in a loop with KillProcess.


loop:
Processes::FindProcess "process_name" ;without ".exe"
StrCmp $R0 1 0 done

Processes::KillProcess "process_name" ;without ".exe"
StrCmp $R0 1 loop

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "process_name could not be closed.$\r$\nTry again?" IDOK loop
Abort

done:


Stu

Originally posted by Afrow UK

loop:
Processes::FindProcess "process_name" ;without ".exe"
StrCmp $R0 1 0 done

Processes::KillProcess "process_name" ;without ".exe"
StrCmp $R0 1 loop

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "process_name could not be closed.$\r$\nTry again?" IDOK loop
Abort

done:


Stu
Thank you sir

BTW KillProcDLL also returns some value :) To kill them all just use it in loop with "...check out $R0 to get the return value". Plug-in returns 0 if "Process was successfully terminated".


Ah yes :)


loop:
KillProcDLL::KillProc "process_name.exe"
StrCmp $R0 603 done
StrCmp $R0 0 loop

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "process_name could not be closed.$\r$\nTry again?" IDOK loop
Abort

done:


Stu

Hmmm... I was looking for a solution to a similar problem (killing a process before uninstalling (deleting) its .exe) and I luckily found this thread.

However, I am somewhat confused by the code you posted here:

First, the readme.txt that accompanies that plugin demonstrates getting the return code by first popping $R0:

  Processes::KillProcess "process_name"

Pop $R0

StrCmp $R0"1" dead_meat why_wont_you_die

dead_meat:
...

why_wont_you_die:
...
However, I tested the code with using the statement Pop $R0 and it seems to work, too. Why? Which is more correct?

Thanks,
Victor

My code is wrong. You need to Pop $R0 with Processes, but KillProcDll simply puts its output into $R0 (without using pushstring internally).

Stu


I have an issue where I need to launch an *.exe but need to kill the running process first.

The issue is the timing. Sometimes it takes a few sections to kill the running process and the *.exe gets launched from within the script (while the process has not been killed).

Further, I need to launch the *.exe silently. Using a loop to kill the process is not feasible for this situation (I’m concerned about a condition failing and my installation getting stuck in a loop – all silently). Is there an alternative? Something similar to ExecWait (where the script would wait to execute the next line until the process has been killed).
Thanks!


You could try the "KillProc" plugin instead of "KillProcDLL" here:
http://nsis.sourceforge.net/KillProc_plug-in

It should be able to kill 'em all http://www.airborneranger.com/forums...k/headbang.gif


This seems like a good plugin, something I was trying to write.
I will give it a try in a day or so. Thanks for the pointer!


Originally posted by zanz
This seems like a good plugin, something I was trying to write.
I will give it a try in a day or so. Thanks for the pointer!
Be aware: This was tested on WinXP only, never tested it on Vista...