Archive: Find and possibly kill process


Find and possibly kill process
Hi,

I am making an installer where it has quite a few executables in it. I want a good way to determine if any of them are running before the installer goes on.

the logic i am using is stupid i think and there must be a better way.

If it finds any of the running processes, i want an error to display and possibly offer the installer to kill it.

FindProcDLL::FindProc "foo1.exe"
${If} $R0 == 1
$err1 = "foo1.EXE"
${Else}
$err1 = ""
${EndIf}

FindProcDLL::FindProc "foo2.exe"
${If} $R0 == 1
$err2 = "foo2.EXE"
${Else}
$err2 = ""
${EndIf}

FindProcDLL::FindProc "foo3.exe"
${If} $R0 == 1
$err3 = "foo3.EXE"
${Else}
$err3 = ""
${EndIf}

; // snip, for two more programs




I was thinking of doing some string length foo here and then concatenate the error messages, separated by new lines
and add a messagebox mb_retrycancel|mb_iconexclamation "the foo installer cannot continue until the following are closed: $\r$\n $errorList" /SD IDCANCEL

and loop back up for the retry, or perhaps add a kill option so it kills and tries again before continuing.

I am really stuck here, been fiddling with this for a few days now.

Any help is greatly appreciated.

Thank you so so so so much!

http://nsis.sourceforge.net/LockedList_plug-in