Archive: Shutting down my application prior to uninstallation if it's currently running


Shutting down my application prior to uninstallation if it's currently running
I want to tell my application to shut down (so it can be uninstalled correctly) if it's currently running.

How would I go about doing this?

-Thanks!
chasetoys


http://www.esanu.name/programs/NSISKillProcess.html
http://nsis.sourceforge.net/Find_Process_By_Name


by the way i already tried from the wiki :

Push "appName.exe"
Call CloseProgram

(didn't compile)... i'm also not sure of what i should tell to close down (i assume the name of the app as seen in the task manager)?


IMHO good practice is to send WM_CLOSE to app's main window first (if any) and to terminate it only if 'still_alive'. This solves problems with files delete/replace that are marked by OS 'in use'. FCT does this.
For applications without main window you can use NsProcess_plugin


Hi,

Use the Processes Plugin

Sample Code:
/* At the Un-Installer Initialization function */
Function un.onInit

Processes::FindProcess "Application.exe"
Pop $R0
IntCmp $R0 0 OK
Message Box MB_OK|MB_ICONSTOP "Error: Please close all running application.exe before proceeding with setup !"
Abort #Abort the Installer

/* No Running Application.exe */
OK:
FunctionEnd

Note: This plugin searches for running specified applications in the process section of Windows Task Manager. You could attain the plugin from;

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

Hope this helps.