Change running application from FindWindow to script detection (tasklist/find).

This commit is contained in:
Julien Wadel 2022-09-01 12:54:40 +02:00
parent 43493de2fd
commit 79f83982bb

View file

@ -905,10 +905,15 @@ SectionEnd
; Choose different default installation folder based on SV_ALLUSERS...
; "Program Files" for AllUsers, "My Documents" for JustMe...
Function .onInit
FindWindow $0 "" "@CPACK_PACKAGE_NAME@"
StrCmp "$0" "0" notRunning
MessageBox MB_OK|MB_ICONEXCLAMATION "@CPACK_PACKAGE_NAME@ is running. Please close it first from the application menu and restart the installation." /SD IDOK
ClearErrors
ExecWait '"cmd" /C ""%SystemRoot%\System32\tasklist" /NH /FI "IMAGENAME eq @CPACK_NSIS_MUI_FINISHPAGE_RUN@" | "%SystemRoot%\System32\find" /I /C "@CPACK_NSIS_MUI_FINISHPAGE_RUN@""' $0
IntCmp $0 1 notRunning
MessageBox MB_OK|MB_ICONEXCLAMATION "@CPACK_NSIS_MUI_FINISHPAGE_RUN@ is running. Please close it first from the application menu and restart the installation." /SD IDOK
Abort
notRunning: