Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to abort Uninstall if application is running


5 replies to this topic

suvidha

suvidha
  • Members
  • 72 posts

Posted 27 June 2001 - 20:57

i am using Installshield Professional for windows Installer 2.0.

i  want to check if the application is running or not and allow user to uninstall only if it is not running.

ie if the application is running and user goes to Control Panel->Add/Remove Programs and removes the application, it should abort saying "Please close the application first".

How can i do this?
please help.

* And our application is a small one with no keys being created in registry.




Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 27 June 2001 - 23:05

A custom action calling windows API FindWindow functions will locate a running program.  

If the app does not have a window then the app could create a synchronisation object such as a semaphore and the CA could test for the existance of that.  This is the best way because you can be sure you have not found another app or window with the same name.

Once you have detected the app you can signal an error in your usual way eg a type 19 CA.


suvidha

suvidha
  • Members
  • 72 posts

Posted 27 June 2001 - 23:32

My application does have a window but the title of this window includes the date (of release) which keeps chaning. That means that i cannot hard code title parameter of this function (FindWindow) i my script.

what should i do?

please help



Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 28 June 2001 - 09:18

Does it have a unique class? FindWindow does not have to look for the name.

As I suggested use a synchronisation object.  You may already have one defined to prevent multiple instances of the app running.  If the app for example creates a semaphore named "{B61AE198-56ED-47C8-B3DD-79EDF5444B16}" (use your own unique name)  your CA tries to create the same semaphore also named "{B61AE198-56ED-47C8-B3DD-79EDF5444B16}".   If the  CA fails to create the semaphore with the error ERROR_ALREADY_EXISTS then the app is running.   If the CA succesfully creates the semaphore the app is not running.


suvidha

suvidha
  • Members
  • 72 posts

Posted 29 June 2001 - 18:26

My application allows multiple instances running at the saem time. So i used FindWindow() to check if the application is running or not.

Thanks for your help.