简体   繁体   中英

Stop a Windows service on re-installation and uninstallation in Inno Setup

I have an installer that starts a service on completion of installation. It stops and deletes the service on uninstallation it stops and deletes the service. After a successful installation of the app if I try to run the installer again it throws an error saying 'Setup has detected that application is already running' . How can I stop the service before installation happens?

Inno Setup reports that, only if you set AppMutex directive .

If you do not want the installer to detect that the application (service) is running, do not set the directive.

If you want to stop the application (service) before the detection, you can do it in InitializeSetup event function in installer, and using InitializeUninstall in uninstaller. Though note that making changes to user's machine before the user confirms anything, is not the right thing to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM