Tuesday 23 August 2011

How to check if some process is running (NSIS)

Use NsProcess plugin. FindProcDLL does not work properly on Windows Server 2008.

!include nsProcess.nsh
...
Section -Main SEC0000
...
App_Running_Check:
   ; is app.exe process running? result is stored in $R0
   ${nsProcess::FindProcess} "app.exe" $R0

   ${If} $R0 == 0
      MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Please stop App.exe before continuing" /SD IDCANCEL IDRETRY App_Running_Check
      Quit
   ${EndIf}
SectionEnd

1 comment:

rani said...

thank you, this is so much help...