Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if the application is running in NSIS before uninstalling

Tags:

nsis

I am new to NSIS, and I need to know that in the uninstaller, how I can check if the application (which is in C++) is running and close it before uninstalling.

like image 394
Mahkameh Avatar asked Apr 02 '10 05:04

Mahkameh


People also ask

What is a NSIS script?

Nullsoft Scriptable Install System (NSIS) is a script-driven installer authoring tool for Microsoft Windows backed by Nullsoft, the creators of Winamp. NSIS is released under a combination of free software licenses, primarily the zlib license.

How do you compile NSIS?

nsi file by simply right-clicking on it in Explorer and selecting 'compile'. If you want to use MakeNSIS on the command line, the syntax of makensis is: makensis [ option | script.


1 Answers

Here is a slightly more friendly version for using NSProcess that requests the app to close rather than terminates it (Owen's answer)

${nsProcess::FindProcess} "${APP_EXE}" $R0

${If} $R0 == 0
    DetailPrint "${AppName} is running. Closing it down"
    ${nsProcess::CloseProcess} "${APP_EXE}" $R0
    DetailPrint "Waiting for ${AppName} to close"
    Sleep 2000  
${Else}
    DetailPrint "${APP_EXE} was not found to be running"        
${EndIf}    

${nsProcess::Unload}
like image 161
fiat Avatar answered Oct 18 '22 17:10

fiat